home *** CD-ROM | disk | FTP | other *** search
Text File | 1986-10-19 | 221.7 KB | 5,746 lines |
- 066010303050000132002006006010000
- 11
- 2- # -1
- F0110000001
- R [.◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆...]0010
- 9[....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆..]1010
- ü
-
-
-
-
-
-
-
-
-
-
-
-
-
- 9[....◆....◆....◆....◆....◆....◆....◆..]3010
- YourSecond
- GFA-BASIC3.0
- Manual
-
-
-
- 9[....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆..]1010
- SecondEdition
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- (c)HanKempen
- Coevorden,1990Ç
-
-
-
-
-
-
-
-
-
-
- üEverythingyoualwayswantedtoknowabout
- GFA-Basic3.0,butwereafraidtoask
-
- 9[:::::::::::::::::::::::::::::::::::::::◆::::◆::::◆::::◆::::◆::::◆::::◆::::◆:]1010
- üëCONTENTS
- ü
-
- êINTRODUCTIONÇ..........................7ê
- Ç
- ê1.GENERALÇê
- ÇStart-up..............................9
- Application...........................9
- Monitor...............................10
- Break.................................10
- OperatingSystem......................10
- ê
- 2.THEEDITORÇê
- ÇAbbreviatedCommands..................12
- Syntax................................12
- FoldedProcedures.....................13
- Tab...................................13
- CutandPaste.........................13
- Load..................................13
- Save..................................14
- Llist.................................14
- Insert-mode...........................15
- Directmode...........................15
- DEFLIST...............................15
- SpecialCharacters....................16
-
- ê3.VARIABLESÇê
- ÇVariableType.........................17
- DEFWRD................................17
- Boolean...............................17
- Integer...............................18
- FloatingPoint........................18
- VAR...................................18
- FUNCTION..............................19
- CLEAR.................................19
- ERASE.................................19
- DUMP..................................19
- TYPE..................................20
- READ..................................20
- SWAP..................................20
- TIME$.................................21
- TIMER.................................21
- DATE$.................................22
-
- ê4.MEMORYÇ
- RAM...................................23
- INT{}.................................23
- RESERVE...............................23
- INLINE................................24
- MALLOC................................25
- ê
- ê5.SORTÇê
- ÇQSORTv.SSORT........................26
- QSORTofnumber-arrays................26
- QSORTofstring-arrays................26
- ê
- 6.OPERATORSandNUMERICALFUNCTIONSÇê
- Ç\.....................................29
- PREDandSUCC.........................29
- MOD...................................29
- BCLR..................................29
- BSET..................................30
- BCHG..................................30
- LOG...................................30
- SINQandCOSQ.........................30
- EQV...................................31
- CARDandSWAP.........................31
- MAX...................................31
- Correlation...........................31
- ê
- 7.STRINGSÇ
- INSTR.................................32
- LSETandRSET.........................32
- Parser................................32
- ê
- 8.KEYBOARDINPUTÇ
- INKEY$................................33
- INPUT.................................34
- INPUT$................................35
- LINEINPUT............................35
- KEYTEST...............................35
- KEYGET................................35
- KEYLOOK...............................36
- KEYPRESS..............................37
- KEYDEF................................37
- Keyboard..............................37
- Keyclick,KeyrepeatandCapsLock......38
- ê
- 9.SCREENOUTPUTÇ
- PRINT.................................40
- LOCATE................................41
- PRINTTAB.............................42
- Setscreen(XBIOS5)...................42
- Font..................................43
- ê
- 10.PRINTERÇê
- ÇPrinterready.........................45
- HARDCOPY..............................45
- Printer-commands......................47
- ê
- ê11.FILESÇ
- FloppyWriteTest.....................50
- StepRate.............................50
- RAM-disk..............................50
- DIR$()................................50
- DIRandFILES.........................51
- FSFIRSTandFSNEXT....................52
- EXIST.................................54
- LOF...................................54
- TOUCH.................................54
- NAME..................................54
- KILL..................................54
- FileCopy.............................55
- DiskFormat...........................55
- FileAllocationTable(FAT)...........58
- Sectors...............................59
- Bootsector............................61
- BLOAD.................................61
- INPandOUT...........................62
- INPUTandLINEINPUT..................62
- STOREandRECALL......................62
- FILESELECT............................63
-
- ê12.MIDIÇê
- ÇINPMID$...............................67
- INP...................................67
- Midi-commands.........................67
- ê
- 13.MODEMÇ
- INPAUX$...............................70
- INP...................................70
- Rsconf(XBIOS15)......................70
- ê
- 14.MOUSEÇ
- Editor................................71
- Fileselector..........................71
- MOUSE.................................71
- SETMOUSE..............................71
- DEFMOUSE..............................72
- ê
- 15.JOYSTICKÇ
- STRIGandSTICK.......................74
- ê
- 16.SOUND
- ÇSOUNDandWAVE........................75
- Dosound(XBIOS32)....................75
- Samples...............................76
- Speech................................77
- Soundmachine..........................77
- ê
- ê17.PROGRAMDECISIONSÇê
- ÇIF...ENDIF..........................78
- SELECT................................78
- ê
- 18.PROGRAMLOOPS
- ÇCalculations..........................79
- FOR...NEXT..........................79
- Loops.................................80ê
-
- 19.PROGRAMCONTROLÇ
- GOSUB.................................82
- ONBREAKGOSUB........................82
- ERROR.................................82
- EVERYandAFTER.......................82
- GOTO..................................82
- DELAY.................................83
- CHAIN.................................83
- EXEC..................................83
- ê
- 20.GRAPHICS
- ÇSETCOLORandVSETCOLOR................84
- Palette...............................84
- DEFMARK...............................87
- DEFFILL...............................87
- DEFLINE...............................89
- DEFTEXT...............................89
- GRAPHMODE.............................90
- PLOTandDRAW.........................91
- PCIRCLE...............................92
- CURVE.................................92
- TEXT..................................92
- SPRITE................................93
- VQT_EXTENT............................95
- Line-A................................95
- HLINE.................................96
- ACHARandATEXT.......................96
- GETandPUT...........................96
- Degas-Pictures........................97
- Neochrome-Pictures....................98
- VSYNC.................................98
- Scroll................................98
- ACLIP.................................99
- Blitter...............................99
-
- ê21.EVENTSÇê
- ÇMENU()................................101
- ONMENUBUTTON........................101
- ONMENUIBOX..........................102
- ê
- ê22.PULLDOWNMENU
- ÇOPENW0...............................103
- Desk-submenu..........................103
- File-submenu..........................103
- ê
- 23.WINDOWSÇ
- GFA-windows...........................104
- CLOSEW................................104
- TITLEW................................105
- CLEARW................................105
-
- ê24.AES-LIBRARYÇ
- ALERT.................................106
- SHEL_GETandSHEL_PUT.................106
-
- ê25.GFAXPERT-FILESÇê
- ÇGFAXPERT.DOC..........................108
- GFAXPERT.LIB..........................108ê
- ÇINLINE................................108ê
- ÇSTANxxxx.LST..........................108
- START.................................112
- ásmallprintóÇ...........................113
-
- êEPILOGUEÇ..............................114
-
- êINDEXÇ.................................115ê
-
-
- 9[....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆....◆..]1010
- üëINTRODUCTION
- Ç
- ü
- ÇRightnowyouarereadingthesecondeditionofthetextGFAXPERT.DOC.
- ThistextisnotmeanttobeareplacementofyourGFA-manual.Onthe
- contrary,IassumeyouarealreadyfamiliarwiththeGFA-manualandnow
- wanttoknoweverythingaboutGFA-Basic3.0thatisnotdescribedproperly
- inthemanual.
-
- Thistextisaboutthe(hidden)powerofGFA-Basic3.0.Youwillfind
- nothingaboutversion3.5,apartfromthissentence.Andthissentence,
- becauseIwouldliketomentionthatIdon'tunderstandwhyGFAlaunched
- version3.5.GFA-Basicisbecomingfartooexpensive.
-
- Allremarksinthistext,especiallyaboutbugs,arebasedonGFA-Basic
- 3.07.Istillhopeversion3.08willbecomeavailable(hownaive...),
- otherwiseI'llhavetowaitforversion4.Notversion4.00ofcourse,
- becauseIknowtherewillbeatleast200bugsinthefirstrelease.
-
- IwrotethistextbecauseIwasdisappointedbythecontentsofmostbooks
- aboutGFA-Basic3.0.Someauthorsusepageafterpagetodescribeaboring
- program.Othersdelvedeeplyintomenu's,windowsandRSC,butignorethe
- "regular"Basic-commands.Insteadofcomplaining,Idecidedtowritethe
- bookthatIwouldreallyliketoseemyself.Hereitis.Forgetallother
- booksaboutGFA-Basic,youneedonlytwothings:yourGFA-manualandthis
- text.Andtobehonest,perhapsagoodbookabouttheAES-library,because
- youwon'tfindmuchaboutthatsubjectinthistext.
-
- InthistextyouwillfindquiteafewProcedures.MostProceduresthat
- arelisted(ormentioned)inthistextcanbefoundinoneoftheLST-
- filesinthefolderGFAXPERT.LIB.Downloadersshouldlookforthefile
- GFAXPRT2.ARC.
-
- Istronglyadviseyoutoreadthechapter'GFAXPERT-FILES'thoroughly,
- beforeyoutrytousetheProcedure-libraryGFAXPERT.LIB.Especiallynote
- thefollowing:
- (1)êwordÇ-variablesarethedefault
- (2)acoupleofvariablesaredeclaredasêStandardGlobalsÇ
- (3)someêStandardFunctionsÇaredefined
- (4)afewêStandardProceduresÇarepresent
- (5)theêStandardArrayÇcolor.index()isdeclared
- AProcedurecoulduseanyoftheStandardGlobals,Functions,Procedures
- ortheStandardArray.Iusuallymentionthisincomment-linesinthe
- Procedure.IfyouMergesuchaProcedureintoanexistingprogram,you
- willhavetoadaptyourprogramortheProcedure.
-
- IstillbelieveinGFA-Basic3.0.AndIalsobelieveinsharingideas,
- Proceduresandprogramswithotherusers,startingwithyou.Ifyoufeel
- guiltyaboutreceivingallthesegoodiesfor(almost)nothing,youwill
- findafreeconsultinthechapter'EPILOGUE'.
-
- ÇIcouldonlywritethistextbecausemanyGFA-userssharedtheir
- experiencewithothers.Idedicatethistexttothem.Specialthanksto
- everyonewhopointedoutbugs,mistakesandomissionsinthefirstedition
- ofGFAXPERT.DOC.Allmistakesinthesecondeditionaremadeby
-
-
- HanKempen
-
-
- üë1.GENERAL
- ü
-
- Start-upÇ
-
- ProgramsinanAUTO-folderareexecutedautomaticallyafterareset.The
- interpreterGFABASIC.PRGisaGEM-program,andcannotbestartedinthis
- way.WithTOS1.4youcaninstallaGEM-programasauto-booting.With
- olderTOS-versionsyoucoulduseaprogramlikeHEADSTRT.PRGinyourAUTO-
- foldertostartGFABASIC.PRGautomatically.Youcan'tstartaGFA-program
- thisway(Ithink).
-
- Ifyouhavewrittena(compiled)programthatcanberuneitherfromthe
- AUTO-folderorfromthedesktop,youcandeterminewhichisthecase:
- IFPEEK(&H2C+4)=0 !4thbyteofLine-Fvector
- (...) !AUTO
- ELSE
- (...) !desktop
- ENDIF
-
- Thereareseveralwaysto(re)startyourcomputer.Theobviousoneisto
- switchtheSToff,waitafewseconds(15secondswitha1040ST!),and
- switchonagain.Thisiscalleda"cold"or"hard"reset.Yourcomputer
- suffersalittle,andittakessometime.Ifyouusethereset-buttonon
- yourST,youperforma"warm"or"soft"reset.Theoperatingsystem
- automaticallyperformsawarmresetifyouswitchbetweenLowandMedium
- resolutiononthedesktop.Ifyoususpectaprogramofchangingsystem
- variables,youshouldalwaysuseacoldreset.Afterawarmresetthe
- systemvariablesinlowmemoryareênotÇinitialisedagain.Garbagewill
- staythereandwillundoubtedlyleadtointerestingeffects.Youcan
- performbothawarmandacoldresetfromGFA-Basicwiththefollowing
- Procedures:
- PROCEDURE coldstart
- SLPOKE &H420,0
- SLPOKE&H426,0 !probablynotnecessary
- SLPOKE &H43A,0
- ~XBIOS(38,L:LPEEK(4))
- RETURN
- '
- PROCEDURE warmstart
- ~XBIOS(38,L:LPEEK(4))
- RETURN
-
- Ifyouwouldliketobootfromyoursecond(external)driveB,try:
- SLPOKE&H446,1 !bootfromdriveBafternextreset
- @warmstart
-
-
- üApplicationÇ
-
- ItisconvenienttoinstalltheextensionGFAasanapplicationfor
- GFABASIC.PRG.ClickonceonGFABASIC.PRGandchooseInstallApplication
- fromtheOptions-menu.TypeGFAasDocumentType,clickonOKandsavethe
- desktop.Ifyoudouble-clickaGFA-program(extension.GFA)fromthe
- Çdesktop,GFABASIC.PRGisautomaticallyloadedfirst.ChoosingInstall
- Applicationyouwillonlyseethemostrecentlyinstalledapplication.Use
- adisk-editortoexaminethefileDESKTOP.INFandyouwillfindall
- installedapplications(lookfor#G).Youcouldalsousethemethod
- describedintheparagraph'SHEL_GETandSHEL_PUT',ortheRECALL-method
- fromtheparagraph'STOREandRECALL'.
-
-
- üMonitorÇ
-
- TheAtaricolourmonitorSC1224workswithaverticalfrequencyofeither
- 50Hzor60Hz:
- SPOKE&HFF820A,254 !50Hz
- SPOKE&HFF820A,252 !60Hz
- For60Hz,bit1oftheSyncModeRegisteriscleared.Don'tchangebit0,
- orthevideocontrollerchipwillnotusetheso-calledsyncpulses.After
- areset,theoperatingsystemdefaultsto50Hz.Thescreenisalittle
- largerthanat60Hz,butthescreenflickersslightly.Ifyouconnect
- yourSTtoaTVthroughamodulator,youshoulduse50Hz.Otherwiseyou
- areadvisedtouse60Hz.
-
-
- üBreakÇ
-
- It'snoteasytofindintheGFA-manual:youcanstoparunningprogramby
- pressing<Control><LeftShift><Alternate>simultaneously.Butifyou're
- readingthistext,youknowthisalready.It'simpossibletointerrupta
- programduringDELAY!StudytheStandardProcedureBreakinoneofthe
- STANxxxx.LST-filestoseehowIreactaftera'Break'.
-
-
- üOperatingSystemÇ
-
- IfyouprograminalanguagelikeGFA-Basic,youwon'tnoticemuchofthe
- actualworkhorseinsideyourST-computer:TheOperatingSystem(TOS).But
- evenGFA-BasicdoesnothaveaBasicequivalentforallTOS-functions,
- althoughyoucanusealmostallfunctionsfromGFA-Basic.
-
- TOScanbedividedintwomainparts:(GEM)DOSandGEM.Thefirstisa
- collectionof"lowerlevel"routinesforcommunicationwithkeyboard,
- screen,printer,etc.InGFA-Basicyoucancalltheseroutineswiththe
- commandsBIOS,XBIOSandGEMDOS.TheGraphicsEnvironmentManager(GEM)
- consistsoftwocollectionsofroutines:theVDI(VirtualDevice
- Interface)andtheAES(ApplicationEnvironmentServices).TheVDItakes
- careofregulargraphicsandshouldhaveincludedGDOS.Atarididn't
- includeGDOSintheVDI,soyouhavetoloaditifyouneedit.MostVDI-
- functionshaveaBasicequivalentinGFA.TheAEStakescareofthe
- communicationwiththeuserthroughmenu,Alert-box,window,etc.Most
- AES-functionscanbeaccessedthroughtheAES-libraryinGFA-Basic3.0.
-
- WithGEMDOS-function48(Sversion)youcanfindtheversionofyour
- GEMDOS.ForboththeoldTOSandtheBlitter-TOS&H1300(version0.19)is
- returned.TheFrenchTurbo-DOShasversion0.20andthenewRainbowTOSof
- 1988hasversion0.21.
- ÇAnotherwaytofindouttheversionofTOSusesthesystemheaderofTOS
- (notnecessarilylocatedinROM!):
- adr%=LPEEK(&H4F2)
- version$=HEX$(DPEEK(adr%+2))
- ThegoodoldROM-TOS(1986,actuallynotsogood)hasversion&H0100
- (1.0),theMega-STBlitter-TOS(1987)version&H0102(1.2).Andofcourse
- thenewTOS('RainbowTOS')hasversion1.4.Youcouldalsoexaminethe
- dateofyourTOS-version:
- date$=HEX$(LPEEK(adr%+24))
- MyancientTOS1.0has'11201985'asthedate.
-
-
- üë2.THEEDITOR
- ü
-
- AbbreviatedCommands
- Ç
- Theeditorrecognizesthefollowingabbreviations(notacompletelist):
-
- ALINE -ALI FILESELECT-FILE POLYMARK -POLYM
- ARECT -AR FILL -FI PRINT -Por?
- ARRAYFILL -ARR FUNCTION -FU PROCEDURE-PRO
- ATEXT -AT GOSUB -Gor@ PSET -PS
- BMOVE -B GRAPHMODE -GRA QUIT -Q
- BOUNDARY -BOU HIDEM -HI REPEAT -REP
- CASE -CA HLINE -HL RESTORE -RES
- CIRCLE -CI IF -I RETURN -RET
- CLOSE -CL INPUT -INP RSET -RS
- COLOR -C LINE -LI SELECT -S
- DATA -D LINEINPUT-LI SETCOLOR -SET
- DEFFILL -DEFF LOCAL -LOC SETMOUSE -SETM
- DEFLINE -DE LOOP -L SGET -SG
- DEFMARK -DEFMA LPRINT -LPR SHOWM -SH
- DEFMOUSE -DEFM LSET -LS SWAP -SW
- DEFTEXT -DEFT MID$(..)= -MI ..)= TEXT -T
- DELETE -DEL MOUSE -MOU UNTIL - U
- DRAW -DR NEXT -N VOID -V
- EDIT -ED OPEN -O VSYNC -VS
- ELLIPSE -ELL PAUSE -PA WAVE -WA
- ELSE -E PBOX -PB WEND -WE
- ENDFUNC -ENDF PCIRCLE -PC WHILE -W
- ENDIF -EN PELLIPSE -PE
- ENDSELECT -ENDS PLOT -PL
- ERASE -ERA POLYFILL -POLYF
- EXITIF -EX POLYLINE -POL
-
- Iftheabbreviatedcommandisfollowedbyanythingelse,youhaveto
- insertaspace(e.g.'C1'),exceptwith'@'and'?':
- @proc1
- Gproc1
- '
- ?"hello"
- P"hello"
-
-
- üSyntax
- Ç
- Theparserchecksforcorrectsyntaxafteryoupress<Return>.Manytypo-
- bugsarepreventedthisway.Theonlydisadvantageisthattheparser
- recognizessomevariablesascommands.It'simpossibletousethefollo⑨
- wingnamesastheêfirstÇwordonaline:data_byte|,dirty$,double,
- printer$,file%,quit!.Thelastoneisnasty,becausetheparserchanges
- theline'quit!=FALSE'into'QUIT!=FALSE'withoutwarningforasyntax-
- error.IfyounowruntheprogramyouwillreturntothedesktopwhenQUIT
- isencountered.Ofcourseyouhavenotlostyourvaluableprogram,because
- youalwaysSavebeforeyouRun.Doyoureally?Iftheparserrefusesthe
- Çnameofavariable,youcanuseLET(e.g.'LETquit!=FALSE').Butyouwill
- havetochangethenameifitisalabel(e.g.thelabel'data1:'couldbe
- changedinto'1data:'or'd.ata1:').
-
-
- üFoldedProcedures
-
- ÇIfyoupress<Control><Help>onaProcedure-line,allProceduresfollo⑨
- wingandincludingthecurrentonearefolded/unfolded.Youcanunfoldall
- ProceduresatoncebyputtingthecursoronthefirstProcedure-lineand
- pressing<Control><Help>.IsuggestyouleaveallProceduresinthe
- Procedure-LibraryGFAXPERT.LIBfolded,unlessyouwanttoexaminea
- Procedure.Theeditor-commands'Find'and'Replace'willskipfolded
- Procedures.NeverchangetheProcedure-lineofafoldedProcedure,always
- unfolditfirst.
-
-
- üTab
- Ç
- Ifyoupress<Tab>,thecursorjumpstothenexttab-position,without
- alteringthecurrentline.Ifyouuse<LeftShift><Tab>,thelineis
- filledwithspacesfromthecurrentcursor-positiontothenexttab-
- position.Pressing<RightShift><Tab>erasesallconsecutivespacesto
- theleftofthecurrentcursor-postition.Ifthecurrentcursor-position
- happenstobeaspace,thisspaceandallspacestotherightareerased
- aswell.
-
-
- üCutandPasteÇ
-
- Ifyoupress<Control><P>,thecurrentlinefromthecursortotheendof
- thelineiscut,andsavedinaninternalbuffer.<Control><O>inserts
- thesavedlineatthecurrentcursor-position.Youcanusethismethodto
- "cutandpaste"apartofaline.Press<Control><P>,then<Control><O>
- torestoretheoriginalline.Movethecursortothedesiredpositionand
- press<Control><O>.Block-operationsareonlypossiblewithcomplete
- lines.
-
-
- üLoad
- Ç
- YoucanuseLoadonlywith*.GFA-files,notwithASCII-files(suchasthe
- *.LST-files).ST-BasicfilesareASCII-files,soyoucanMergethem.
-
- MorerecentprogramsinGFA-Basic(from3.04)cannotbeloadedbyearlier
- interpreters(upto3.02).Ofcourseyoushouldhavethemostcurrent
- version(atleastversion3.07),butthefollowingmethodshouldalways
- work.Lengthentheprogramuntilyoucanloaditsuccessfully:
- OPEN"A",#1,file$
- PRINT#1,STRING$(1000,0)
- CLOSE#1
-
-
- üSaveÇ
-
- After'Save'(*.GFA-file)or'Save,A'(*.LST-file)withanexistingfile,
- theoldfileisrenamedwithaBAK-extension.Niceprecaution,butyou
- shoulddeletethose*.BAK-fileseverynowandthen.
-
- Ifyoukillandsavefilesregularly,newfileswillbestoredina
- fragmentedway.Loadingafragmentedfiletakesmoretimethanloadinga
- filethatoccupiesconsecutivesectorsonthedisk.Youcancorrectthis
- asfollows.Firstmakeabackup-disk(yes,youshouldalreadyhaveone).
- CopyallfilestoaRAM-diskbyclickingonthedrive-iconanddraggingit
- tothewindowofthedestinationdrive.Youcan'tusedisk-copy(dragging
- drive-icontodrive-icon)becausethedestination-driveisaRAM-disk.
- Formatthesource-diskandcopyallfilesback(thisêmustÇbeafile-copy,
- notadisk-copy).Now,allfilesaresavedonconsecutivesectors.You
- couldspeedupthingsalittlebitmorebycopyingthemost-usedfiles
- first.Thedrive-headnowneedslesstimetoreachthesefiles.
-
- Don'ttryto'Save,A'anexistingfiletoafulldisk.Ihavetriedit
- onceandlostboththeoriginalfile(shouldhavebecomea*.BAK-file)and
- ofcoursethesavedfile.Also,theeditor(orTOS)haderasedtheprogram
- frommemory...Thankyou.
-
-
- üLlistÇ
-
- Therehasbeensomeconfusionaboutthefollowingpoint-commandsforthe
- printer:
- .p- -point-commandsarenotprinted
- .p+ -point-commandsareprintedagain
- .llxx -line-width
- .plxx -page-length
- .pa -formfeed
- Sometimesthecommands'.cp'and'.nu'arementioned,butIdon'tknowhow
- tousethese.
-
- Youcanonlyuseonepoint-commandinoneline.Iusethefollowinglines
- formyprinter(96characters/lineinElite-mode):
- .p-
- .n4
- .lr3
- .ll88
- SavethisasLLIST.LSTandMergeitafterthelastlineofaprogram
- beforechoosing'Llist'.Theactuallistingisthenprintedwith80
- characters/line,precededbytheline-numbers(4characters+space).If
- yourprogramislongerthan10000lines,youshoulduse'.n5',butinthat
- caseyouprobablydon'thavetimetoreadthis.Anicetouchisthe
- automaticexecutionofaformfeedafterprintingthelisting.
-
- Ifthelistingcontainsspecialcharacters(ASCII-code<32or>126),
- someofthosecharactersmightbeinterpretedasprinter-commands.My
- printerswitchestocondensedprintingafterreceivingtheAtari-symbol.
- Installingtheproperprinter-driver(e.g.PTEPSON.PRG)willpreventthat.
- ÇButIneverinstallaprinter-driverbecausetherearesomeserious
- disadvantages.Readmoreaboutitintheparagraph'HARDCOPY'.
-
- Youcanstoptheprintingprocessbypressingthe'Break'-combination
- <Control><LeftShift><Alternate>,unlessBreakhasbeendisabledwith
- 'ONBREAKCONT'.Yourprinterwillcontinueprintingthough,untilits
- input-bufferisempty,oruntilyouturntheprinteroff.
- ü
-
- Insert-mode
- Ç
- Ifyoureturntotheeditor,you'llalwaysbeinInsert-mode,evenifyou
- lefttheeditorinOverwrite-mode.Bytheway,theeditorrestoresthe
- originalcolour-palette,soyouarenotbotheredbypalette-changesina
- program.IntheolddaysIwassometimescaughtbythedreadedphenomenon
- ofblackcharactersonablackbackground,butnowyoucanalwaysreadthe
- listingonyourscreen.
-
- Bythesecondway,thereisonlyonethingIdon'tlikeabouttheGFA-
- editor.It'snoteasytomergeaProcedurefromaLST-filewiththe
- programyou'reworkingon.Savetheprogram,clearmemorywith'New',
- 'Merge'theLST-file,marktheProcedureasablock,savetheblock,
- 'Load'theoriginalprogram,findthecorrectlineand'Merge'thesaved
- block.AnewcommandNMerge(New+Merge)wouldmakethelifeofaGFA-
- programmeralittleeasier.AbetterideawouldbethecommandBMerge
- (Block-Merge).ThenIcouldchoosethiscommand,clipaProcedure-block,
- andtheblockwouldbeinsertedinthelistingautomatically.Areyou
- readingthis,Frank?Ifyouare,howaboutafunctionforchangingupper
- caseintolowercase.IntheGFA-EDITORISOMETIMES(oops)forgetI
- pressedCapsLock.Andhowaboutafunctiontoclearalinefromthecursor
- tothenextspace-character.And...
-
-
- üDirectModeÇ
-
- EntertheDirectModebypressing<Esc>or<Shift><F9>intheeditor.
-
- InDirectModeyoucanrestorethepreviouslyusedlinewith<Undo>.With
- <Uparrow>and<Downarrow>youcanevenrecallupto8ofthelastused
- lines.Press<Insert>toswitchbetweenInsert-modeandOverwrite-mode.As
- usual<Esc>clearstheline,butifyoupress<Esc>onanemptyline,you
- willreturntotheeditorimmediately.Youcanalsoreturntotheeditor
- with<Control><Shift><Alternate>,evenwithoutfirstclearingthe
- command-line.YoucancallProceduresinyourprogramfromtheDirectMode
- (e.g.'@show').Ifyou(temporarily)mergesomespecialProcedureswith
- theprogramyouaredeveloping,youcouldusetheDirectModeasaCommand
- LineInterpreter.
-
-
- üDEFLISTÇ
-
- Thecommand'DEFLISTn'onlyworksinDirectMode,notinaprogram.You
- canalsochoose'Deflist'fromthedrop-downmenu,afterclickingonthe
- Atari-symbol.
- üSpecialCharacters
-
- ÇYoucanentercharacterswithASCII-codeüÇ32-126üÇdirectlyfromthekey⑨
- board.ThesecharactersareusuallycalledASCII-characters.Thecodes
- 0-31and127areusedascontrol-codes,butadditionallyspecialcharac⑨
- tershavebeenassignedtothesecodes.Thecharacterswithcode128-255
- aresometimescalled"extendedASCII-characters"andarepartlyidentical
- totheIBM-characterswiththesamecodes.Ilooselyusetheexpression
- "ASCII-code"forallcodes0-255.
-
- Youcanentercharacterswithcode0-31or127-255bypressing<Alternate>
- andthenenteringthecharactercode.Releasethe<Alternate>-keyandthe
- characterappearsonyourscreen.E.g.,youcouldentertheEscape-
- characterbyholding<Alternate>downandpressing<2>and<7>.Thisis
- muchfasterthanenteringCHR$(27),butLlistingafilewithEscape-
- charactersisprobablynotagoodidea(lessimportant,1stWordPlus
- couldgetconfusedtoo).LlistingCHR$(27)doesn'tbotheryourprinterat
- all.It'snotpossibletoenterCHR$(10)orCHR$(13)withthe'Alternate'-
- way.Youcanenterthefirstbypressing<Control><A>andthen<1><0>
- <Return>.Forcode13youhavetouseCHR$(13).
-
- Neverusecode4(EOT,visibleasleftarrow)inaLST-file.IfyouMerge
- aLST-file,theGFA-editorthinkstheendofthefileisreachedatthat
- point(&H04)andrefusestoloadanythingfollowingthiscode!
-
-
- üë3.VARIABLES
- Ç
-
- üVariable-typeÇ
-
- InGFA-Basicweusetheexpressions'Byte','Word'and'Integer'forthe
- threeinteger-variables.Becauseallthreeareintegers,theexpression
- 'Integer'forthe4-byteinteger-variableissligthlyconfusing.Inother
- languagesthisvariableiscalled'Longword'orsimply'Long'.Anaddress
- inRAMshouldalwaysbea4-byteinteger.
-
- ü
- DEFWRDÇ
-
- Iprefertodeclareword-variablesasthedefault(forvariableswithout
- postfix)with:DEFWRD"a-z"
-
- Irecommendtheuseofword-variables(2bytes)fortworeasons.In
- calculations,theuseofthespecialinteger-operators(ADD,SUB,INC,
- etc.)speedstheprogramupconsiderably.Ifyouinsistonusingthe
- regularoperators(+,-,etc.)youshouldusefloatingpointvariables
- instead.Usingtheregularoperators,theinterpreterhastoconvert
- integer-variablestofloatingpoint,doesthecalculationandconvertsthe
- resultbacktointegeragain.That'swhya#*b#iscalculatedfasterthan
- a&*b&.ButMUL(a&,b&)ismuchfasterthana#*b#.Ittakessometimeto
- recognizewhatanexpressionlikeDIV(a,MUL(ADD(a,b),SUB(b,c)))means.I
- suggestyouusetheregularoperatorsifthecalculation-timeisnot
- critical.Inloops,thegainincalculationtimereallycounts,soyou
- shouldusetheinteger-operators.ThatwayyouwilllearnPolishtoo.The
- secondreasonforusingword-variablesis,thatinacompiledprogram
- calculationswithword-integersareusuallythefastest.
-
- IMPORTANT:ifanumber-variablehasnopostfixinthistext,youshould
- assumeit'saêwordÇ-variable.I'llusethepostfix|,%or#where
- appropriate.Pleasenotethattheinterpreterassumesanumber-variable
- withoutpostfixisafloatingpointvariable,unlessyouuseDEFWRD"a-z".
-
-
- üBooleanÇ
-
- Thefollowingfivelines:
- IFnumber>0
- test!=TRUE
- ELSE
- test!=FALSE
- ENDIF
- canbeshortenedtojustoneline:
- test!=(number>0)
- Thisworks,becausethe'>'-operatorreturnsTRUEorFALSE(actually-1
- or0).
-
- ÇAnotherlittletrick:
- IFi=1
- n=n*2
- ELSEIFi=2
- n=n*5
- ELSE
- n=0
- ENDIF
- Thiscouldbeshortenedto:
- n=n*-2*(i=1)üÇ+n*-5*(i=2)
- Theexampleisridiculous,buttheprincipleinvolvedcouldbeuseful.The
- expressions'i=1'and'i=2'areeither0(FALSE)or-1(TRUE).
-
- Itisnotnecessarytousesomethinglike:
- IFflag!=TRUE
- (...)
- ENDIF
- Youcansimplyuse:
- IFflag!
- (...)
- ENDIF
-
-
- üIntegerÇ
-
- Youcan'tassign2^31toa4-byteinteger-variable.Althoughaninteger
- contains32bits,youcan'tusebit31.Thisbitisaflagforanegative
- integer.Thelargestpositivenumberyoucanassigntoaninteger-variable
- istherefore2^31-1(2147483647).Icouldhavewrittenananalogue
- paragraphaboutthe2-byteword-variables,butIdidn't.
- ü
-
- FloatingPoint
- Ç
- Therangeoffloatingpointvariables(postfix#)is:
- -1.0E1000<x#<1.0E1000
- LargerorsmallernumbersêcanÇbeusedincalculations,butnotprinted,
- becausetheexponentmaycontainnotmorethan3digits(1.0E1000is
- displayedas1.0E;00).
-
-
- üVAR
- Ç
- IfyoucallaProcedureanduseVAR(callbyreference),êallÇvariables
- and/orarraysafterVARarecalledbyreference.Anexampletoclarify
- this:
- @test(10,5,number%,array%())
- (...)
- PROCEDUREtest(a,b,VARx%,y%())
- 'nowa=10andb=5(callbyvalue)
- 'number%andarray%()cannowbeusedasx%andy%()
- x%=a+b !globalvariablenumber%isnow15
- ARRAYFILLy%(),1 !allelementsofarray%()arenow1
- RETURN
- ÇInprehistoricdaysyoucouldhaveusedSWAP,butVARmakeslifeeasier:
- @test(*a%())
- (...)
- PROCEDUREtest(ptr%)
- SWAP*ptr%,x%() !arraya%()temporarilyrenamedasx%()
- (...) !dosomethingwiththearray
- SWAP*ptr%,x%() !restorepointerbeforeleavingProcedure
- RETURN
-
-
- üFUNCTIONÇ
-
- YoucanonlyleaveaFUNCTIONbyRETURNingavalueorastring.This
- value/stringisusuallyassignedtoavariable.IftheFUNCTIONreturnsa
- string,thefunction-namehastoendwith'$':
- FUNCTIONtest
- RETURN126
- ENDFUNC
- '
- FUNCTIONtest$
- RETURN"thisisastring"
- ENDFUNC
- ü
-
- CLEARÇ
-
- BecauseCLEARisautomaticallyexecutedwhenyourunaprogram,it'snot
- necessarytostartyouprogramwiththiscommand.
-
- ü
- ERASEÇ
-
- It'simpossibletoreDIMensionanexistingarray.YoufirsthavetoERASE
- theexistingarrayandthenyoucanDIMensionanewarray.Itisnot
- necessarytotestfortheexistenceofanarraywithDIM?()beforeyouuse
- ERASE.Inotherwords,youcanuseERASEevenifthearraydoesn'texist:
- ERASEarray$() !justincasethisarrayalreadyexists
- DIMarray$(200)
-
- AfterERASEinganarray,GFArearrangestheremainingarrays.Allarrays
- thathavebeenDIMensionedafterthedeletedarrayaremovedinorderto
- fillthegapofthedeletedarray.ThisisimportantifyouuseV:array(0)
- inyourprogram(readtheparagraph'RESERVE').
-
-
- üDUMPÇ
-
- Examineallvariablesinyourprogrambytyping'DUMP'inDirectMode.
- Press<CapsLock>toslowdownthescrolling-speed,orpresstheright
- <Shift>-keytotemporarilystopthescrolling.TheProcedureDebugenables
- youtouseDUMPduringdebugging.Thisisthebestwaytodiscoverthose
- nastytypo-bugsinavariable-name.You'llprobablybesurprisedtosee
- thenamesofdeletedvariablesaswell.Also,anyvariable-nameyouused
- inDirectModeappears.êAllÇthesenamesareSAVEdwiththeprogram!Delete
- Çallunwantednamesasfollows(aRAM-diskwouldbeconvenient):
- -Loadthefile
- -Save,A(press<Return>inFileselector)
- -New
- -Merge(press<Return>again)
- -Save(press<Return>oncemore)
- Thefilecouldbemuchshorterafterthisoperation.
-
-
- üTYPE
-
- ÇThecommandTYPEdoesnotseemtoworkproperlyifyouuselocal
- variables.Idon'tknowwhat'swrong.
-
-
- üREADÇ
-
- Asarule,IalwaysRESTOREtheappropriatelabelbeforeREADingDATA-
- lines.ThatwayIcanuseDATA-linesinProcedures:
- PROCEDUREread.data
- RESTOREthese.data
- (...) !READtheDATAhere
- these.data:
- DATA1,2,3,4
- RETURN
-
-
- üSWAPÇ
-
- The52cardsinbridge(oranothercard-game)canberepresentedbya
- byte-array.Filltheelements1-52ofthearraywiththevalue1-52.The
- values1-13wouldrepresenttheClub-cards(2,3,4,...,Q,K,A),values
- 14-26theDiamonds,values27-39theHeartsandvalues40-52theSpades.
- ShufflingthecardscannowbesimulatedwiththeProcedureShuffle:
- DIMdeck|(52)
- FORi=1TO52 !ignoreindex0
- deck|(i)=i
- NEXTi
- @shuffle(deck|())
- (...)
- PROCEDUREshuffle(VARproc|())
- LOCALi,j
- FORi=DIM?(proc|())-1DOWNTO2
- j=RAND(i)+1
- SWAPproc|(j),proc|(i)
- NEXTi
- RETURN
-
-
- üTIME$Ç
-
- YoucanuseTIME$toprintthecurrenttimeonthescreen.Inthe
- ProcedureTimeyou'llfindawaytoprintthetimeeverysecond,although
- TIME$isupdatedeveryêtwoÇseconds:
- PROCEDURE time
- ' *** activate with : EVERY 200 GOSUB time
- ' *** global : TIMER$
- LOCAL t$
- t$=TIME$
- IF t$=timer$
- MID$(timer$,8)=SUCC(RIGHT$(timer$))
- ELSE
- timer$=t$
- ENDIF
- PRINT AT(1,1);timer$
- RETURN
-
-
- üTIMERÇ
-
- Ifyouneedastopwatch,youcanusethefollowingProcedures:
- PROCEDURE stopwatch
- ' *** global : STOP.SECONDS# STOP.H STOP.M STOP.S WATCH.ON!
- LOCAL s#
- IF watch.on!
- stop.watch#=TIMER
- stop.seconds#=(stop.watch#-start.watch#)/200
- stop.h=stop.seconds#/3600
- s#=stop.seconds#-stop.h*3600
- stop.m=s#/60
- stop.s=s#-stop.m*60
- watch.on!=FALSE
- ELSE
- watch.on!=TRUE
- start.watch#=TIMER
- ENDIF
- RETURN
- '
- PROCEDURE print.stopwatch
- IF stop.h>0
- PRINT stop.h;" h ";stop.m;" m";
- ELSE
- IF stop.m>0
- PRINT stop.m;" m ";stop.s;" s";
- ELSE
- IF stop.seconds#>=10
- PRINT USING "##.# s",stop.seconds#;
- ELSE
- PRINT USING "#.## s",stop.seconds#;
- ENDIF
- ENDIF
- ENDIF
- RETURN
- ÇYoustartthestopwatchbycallingtheProcedureStopwatch.Callingthis
- Procedureagainwillstopthestopwatch.ThenyoucanPRINTtheelapsed
- timeatthecurrentcursor-positionwiththeProcedurePrint.stopwatch,or
- youcoulduseoneoftheGlobalVariablesfromtheProcedureStopwatchto
- dosomethingelse.
-
-
- üDATE$
- Ç
- FindthedayoftheweekwiththeProcedureDay.of.week:
- PROCEDURE day.of.week(day.date$,VAR day$)
- LOCAL day,mp,month,year,m,h,w,week$,n
- day=VAL(LEFT$(day.date$,2))
- mp=INSTR(day.date$,".")
- month=VAL(MID$(day.date$,mp+1,2))
- year=VAL(RIGHT$(day.date$,4))
- IF month<=2
- m=10+month
- year=year-1
- ELSE
- m=month-2
- ENDIF
- h=year/100
- y=year-100*h
- w=(TRUNC(2.6*m-0.2)+day+y+TRUNC(y/4)+TRUNC(h/4)-2*h) MOD 7
- RESTORE weekdays
- FOR n=0 TO w
- READ day$
- NEXT n
- '
- weekdays:
- DATA Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
- RETURN
- ThisProcedureusesZeller'sCongruencetodeterminethedayoftheweek.
-
-
- üë4.MEMORY
- Ç
-
- üRAMÇ
-
- Anoverviewofthememoryofmy1040ST(startatthebottom):
- êaddressÇ
- &HFFFFFtopofmemoryof1040ST(1024K)
- &HFFD00 767unused(?)bytes
- XBIOS(2)=&HF8000screenmemory(32000bytes)
- HIMEM=&HF400016384unusedbytes(MALLOC(-1))
- &H.....freememory(lengthFRE(0)bytes)
- &H388EAprogram+variables(lengthvaries)
- &H10C2EGFA-Basic3.07interpreter
- BASEPAGE=&H10B2EBasepageGFA-Basic(256bytes)
- &HA100startofavailableRAM
- &H6100globalAES-variables
- &H29B4globalBIOS-andGEMDOS-variables
- L~A=&H293ALineAvariables
- &H93AlocalBIOS-variables+BIOS-stack
- &H400BIOSsystem-variables
- &H0exceptionvectors
-
- TheBIOSsystem-variables(&H400-&H4FF)are"castinconcrete"byAtari.
- Other(undocumented)variablesinRAMshouldbeavoided.
-
-
- üINT{}Ç
-
- YoucanuseeitherINT{adr%}orWORD{adr%}.Asyouknow,w=WORD{adr%}is
- fasterthanw=DPEEK(adr%),butyoucan'tuseWORD{}andtheotherrelated
- commandsinsupervisormode.Thismeansyoucan'taccessmemorybelow
- address&H800.OfcourseyoucanPEEK/DPEEK/LPEEKeverywhere(DPEEKand
- LPEEKonevenaddressesonly),andyoucanuseSPOKE/SDPOKE/SLPOKEto
- writeinsupervisormode.
-
-
- üRESERVEÇ
-
- ThecommandRESERVEcanbeusedinthreedifferentways:
- RESERVEn%:reserven%bytesforGFA-Basic,releaseRAMuptoHIMEM
- RESERVE-n%:reservelastn%bytesofRAMuptoHIMEM
- RESERVE:restoretooriginal
- Thesecondcommandismyfavourite.YouêmustÇuseamultipleof256with
- RESERVE.After'RESERVE-400',only256bytesarereleasedtoGEMDOS.In
- thiscaseyouwouldhavetouse'RESERVE-512',althoughyouneedonly400
- bytes!UsetheFunctionMultipleifarithmeticisnotyourstrongest
- point :
- RESERVE-@multiple(n%,256)
- Use'RESERVE-n%'onlyonceinyourprogram.IfyouRESERVEmemorya
- secondtimewith'RESERVE-m%',GFAreleasesm%bytes,ênotÇn%+m%.
-
- ÇThecommandRESERVE(restore)doesnotalwaysfunctionproperly.Especial⑨
- lyafterEXEC3it'softenimpossibletorestorethememory.Isuspect
- thishassomethingtodowiththeuseofthemalloc-functionbythe
- operatingsystem.Youcouldtrythefollowing:
- RESERVE-n% !reserveasmuchasneeded(multipleof256)
- base%=EXEC(3,...) !load,butdon'tstart
- (...)
- ~MFREE(HIMEM) !memoryaboveGFA-Basic
- ~MFREE(base%) !memoryfromBasepageofloadedprogram
- RESERVE !hopeitworksnow
- Don'tbesurprisedbyhang-upsorbombsafterthisoperation...
-
- Thereareseveralwaystoreserveapartofmemoryforspecialpurposes
- suchasmusic,picturesorotherprograms.E.g.,youcoulduseastring-
- variabletostoreacompletescreenoraGET-picture.Don'tusestringsif
- garbagecollectionisaseriousrisk.Ifalargearrayisdeclared,the
- interpretersometimesmovesthestringsinmemorytocreatespaceforthe
- newarray.Ifyouassignanewstringtoanexistingstring-variable,the
- oldstringisnoterased.Duringgarbagecollectionallunusedstringsare
- deletedandtheactivestringsarerearranged.Thismeanstheaddressofa
- string(accessedthroughVARPTRorV:)isnotfixed.That'snotimportant
- foraGET-picture,because'PUTx,y,pic$'stillworksallright.Butif
- youswapscreenswith~XBIOS(5,L:adr%,-1,-1),orcallaroutinewith
- ~C:adr%(...),garbagecollectionwillbefatal.Onesolutionisnottouse
- avariablefortheaddress,buttouseVARPTRorV:.Adifferentapproach
- wouldbetheuseofabyte-array:
- OPEN"I",#1,file$
- LETbytes%=LOF(#1) !howmuchspaceisneeded?
- CLOSE#1
- DIMassembler|(bytes%-1)!createspaceforassembler-routine
- adr%=V:assembler|(0)
- BLOADfile$,adr% !loadtheroutine
- Youcanusethevariableadr%safely,becauseagarbagecollectionhasno
- influenceonarrays.However,afterERASEinganarray,allarraysthat
- havebeenDIMensionedafterthedeletedarrayaremovedinmemory.Sothe
- array-methodisnotreliableeither,unlessyouarecertainthatERASE
- willnotbeusedafteryouhavedeterminedtheaddressofthebyte-array.
- Anothersolutionwouldbetodeclarethebyte-arrayearlyinyourprogram,
- soitwillnotbemovedafterERASE.Theonlycompletesafewayistheuse
- ofINLINEorMALLOC.
-
-
- üINLINEÇ
-
- UseD(=DUMP)todumpanInline-fileinHex-codetotheprinter.
-
- Don'tuse'Save,A',becauseyouwilllosetheInline-code.Youcan'tuse
- INLINEinLST-files.IfyouwouldliketouseINLINEincombinationwitha
- LST-fileyoucouldproceedasfollows.First,createanINLINE-folderin
- themaindirectoryandSAVEtheInline-codeasafile(extensionINL)in
- thisfolder.MergetheLST-fileinyourprogramandloadtheInline-code
- intheINLINE-line.Theprogramshouldbesavedwith'Save'.
-
- ÇTheonlylimitationwithINLINEisthemaximumlengthof32746bytes.If
- youneedmorespace,youhavetouseMALLOC.
-
- IfyouchangethelengthofanexistingINLINE-line,theeditorsometimes
- erasesafewlinesfromyourprogram.It'ssafertocompletelydeletethe
- oldINLINE-lineandthenenterthenewINLINE-line.
-
-
- üMALLOCÇ
-
- ThisishowyoucoulduseMALLOC:
- unused%=MALLOC(-1) !"unused"memoryaboveHIMEM(usedbyGEM)
- RESERVE-n% !releaselastn%bytestoGEMDOS
- max%=MALLOC(-1)
- IFmax%<>0
- adr%=MALLOC(max%-unused%) !n%bytesnowavailabletoGFA-Basic
- ELSE
- 'error
- ENDIF
- (...) !dosomethinginteresting
- ~MFREE(adr%) !givebacktoGEMDOS...
- RESERVE !andbacktoGFA-Basic
- Atarirecommendsyouleaveatleast8KtoGEM,soyoucan'tgowrongif
- youleave16384bytestoGEM(seeparagraph'RAM').
-
- DoênotÇuseMALLOCtoallocatealotofsmallmemory-blocks,asGEMDOSwill
- getconfused.Thisproblemisrelatedtothe"40-folderlimit",because
- MALLOCusesthesamebufferthatisusedtostoreinformationabouta
- folder(seeparagraph'FILESELECT').Allocateonelargeareaandsplitit
- upinasmanypartsasyouneed.AlsoconsidertheuseofINLINE,strings
- orbyte-arraysinsteadofusingMALLOC(readtheparagraph'RESERVE').Do
- notuseMALLOCinanaccessory,ortheallocatedmemorymaybelostifthe
- userchangestheresolution.
-
- MALLOC(-1)returnsthesizeoftheêlargestÇavailablememory-block.Expect
- problemsifanotherprogramhasallocatedacoupleofseparatememory-
- blockstoGEMDOS.InthatcaseyouwouldhavetouseMALLOC(-1)again,
- untilareturnedvalueof'0'indicatestherearenomorememory-blocks
- available.
-
-
- üë5.SORT
- Ç
-
- üQSORTÇüv.SSORTÇ
-
- QSORTisfasterthanSSORT,unlessthearrayisalmostsortedalready.I
- understandQSORTusestherecursiveQuick-sortmethod,soyouneedmore
- memorythanwithSSORT(iterativeShell-sort).Sort-freakscanstudythe
- ProceduresQuick.sort.intandShell.sort.inttoseehowtheQuick-sortand
- Shell-sortcanbeimplementedwithordinaryGFA-Basiccommands(likethat
- dance:Quick,Shell,slow).
-
-
- üQSORTofnumber-arrays
-
- ÇNumber-arrayscanbeQSORTedinthreedifferentways:
- QSORTx%() -sortsarray;alsowithx|(),x&()orx#()
- QSORTx%(),n -sortselements0throughn-1
- QSORTx%(),n,y%() -elementsofy%()areswappedtoo
- Inallcasesx%(-1)resultsinsortingindecreasingorder.
-
- Thethirdmethodisinterestingifyouneedasortedoutput,butdon't
- wanttochangetheoriginalarray.Youcanaccomplishthisasfollows:
- -copyx%()totemporaryarraytemp%()
- -determineindexoflastelement:last=DIM?(temp%())-1
- -createindexarray:DIMindex%(last)
- -fillindex-arraywithindex0throughlast
- -sortarray:QSORTtemp%(),last+1,index%()
- -ERASEtemp%()
- Theindex-arrayêmustÇbeaninteger-array(postfix%).Also,thenumberof
- elementsisênotÇoptionalifyousortwithanindex-array.Youcannow
- printthenumbersinarrayx%()inincreasingorder:
- FORi=0TOlast
- PRINTx%(index%(i))
- NEXTi
-
- IhaveneverseenthecorrectsyntaxforQSORTinprint,sohereitis:
- QSORTx([s])[,n[,y%()]]
-
-
- üQSORTofstring-arraysÇ
-
- Astring-arraycanbesortedinthesamethreewaysasdescribedfor
- number-arrays.Ifyouhavecreatedanindex-arraywithlast_name$(),you
- couldprintanalphabeticallist:
- FORi=0TOlast
- PRINTfirst_name$(index%(i))'last_name$(index%(i))
- NEXTi
-
- Therearetwoextrapossibilitieswithstring-arrays.
-
-
- ÇForthefirstpossibility,createabyte-arrayandfillwithappropriate
- ASCII-values:
- DIMascii|(255)
- ARRAYFILLascii|(),32!CHR$(32)isthespace-character
- FORi=48TO57
- ascii|(i)=i !0-9
- NEXTi
- FORi=65TO90
- ascii|(i)=i !A-Z
- NEXTi
- FORi=97TO122
- ascii|(i)=SUB(i,32) !a-zconvertedtoA-Z
- NEXTi
- Allcharactersthatarenotnumbersorletterswillbetreatedasaspace
- (ASCII-value32).Usethearrayascii|()forsortingastring-array:
- QSORTx$()WITHascii|()
- Now'Atari'and'ATARI'aretreatedexactlythesame,becausethe
- interpreterusesthearrayascii|()toconvertlowercaseletterstempora⑨
- rilytouppercaseêbeforeÇsorting.Youcaneventreattheinternational
- characters(ASCII-values>127)correctly,e.g.ascii|(129)=85.Useafew
- DATA-linestoaddthecorrectASCII-value,likethis:
- DATA128,67,129,85,130,69
- Youcancombinethismethodwithanindex-arrayaswell.Thecorrect
- syntaxis:
- QSORTx$([s])WITHb|()[,n[y%()]]
- Ifyouhavedoneyourhomework,youshouldnowbeabletowriteaclever
- alphabeticalsorting-programyourself.Youwantedtobecomeanexpert,
- didn'tyou?CompareyourprogramwiththeProceduresAscii.qsortand
- String.index.qsort:
- PROCEDURE ascii.qsort(VAR txt$())
- IF DIM?(ascii|())=0
- @initio.ascii.array
- ENDIF
- QSORT txt$() WITH ascii|()
- RETURN
- '
- PROCEDURE initio.ascii.array
- LOCAL i,code1,code2
- DIM ascii|(255)
- ARRAYFILL ascii(),32 ! fill with space-character
- FOR i=48 TO 57
- ascii|(i)=i ! 0 - 9
- NEXT i
- FOR i=65 TO 90
- ascii|(i)=i ! A - Z
- NEXT i
- FOR i=97 TO 122
- ascii|(i)=SUB(i,32) ! a - z, converted to A - Z
- NEXT i
- RESTORE ascii.data
- REPEAT
- READ code1,code2
- ascii|(code1)=code2
- UNTIL code1=0
- Ç '
- ascii.data:
- ' *** format : ASCII-code,replacement
- DATA 128,67,129,85,130,69,131,65,132,65,133,65,134,65,135,67
- DATA 136,69,137,69,138,69,139,73,140,73,141,73,142,65,143,65
- DATA 144,69,145,65,146,65,147,79,148,79,149,79,150,85,151,85
- DATA 152,121,153,79,154,85,155,67,158,83,160,65,161,73,162,79
- DATA 163,85,164,78,165,78,166,65,167,79,176,65,177,79,178,79
- DATA179,79,180,79,181,79,182,65,183,65,184,79,192,121,193,121
- DATA225,83,0,0
- RETURN
- '
- PROCEDURE string.index.qsort(switch!,VAR txt$(),index%())
- ' *** the index-array has to exist already
- ' *** if switch!=TRUE, array ascii|() is used
- LOCAL last,i
- last=DIM?(txt$())-1 ! index of last element
- DIM temp$(last)
- FOR i=0 TO last
- temp$(i)=txt$(i)
- NEXT i
- FOR i=0 TO last
- index%(i)=i
- NEXT i
- IF switch!
- IF DIM?(ascii|())=0
- @initio.ascii.array
- ENDIF
- QSORT temp$() WITH ascii|(),last+1,index%()
- ELSE
- QSORT temp$(),last+1,index%()
- ENDIF
- ERASE temp$()
- RETURN
-
- Thesecondextrapossibilitywithstring-arraysistheuseof'OFFSETo'
- toignorethefirst'o'charactersduringsorting.Supposeyouhave
- createdanarrayfiles$()withFILESandwouldliketosortthefilesby
- length:
- QSORTfiles$()OFFSET13,n
- Thefirstcharacter(eitheraspaceor'*')andthefilename(thenext12
- characters)arenowignoredduringsorting.
-
-
- üë6.OPERATORSandNUMERICALFUNCTIONS
- Ç
-
- ü\Ç
-
- Theoperator'\'(backslash)isidenticaltoDIV:
- a=b\c
- Integer-divisionisnotasusefulastheotherinteger-operations,because
- theresultisaninteger.Ofcourseitis,butthiscaneasilyresultin
- largeroundingerrors.
-
-
- üPREDandSUCCÇ
-
- PRED(i)isfasterthani-1andSUCC(i)isfasterthani+1.Bothfunctions
- canalsobeusedwithstrings.Notethecleveruse(ahem)ofSUCCinthe
- followinglinefromtheProcedureTime:
- MID$(timer$,8)=SUCC(RIGHT$(timer$))
- Therightmostdigitoftimer$(alwayseven)isincreasedwithone.
-
-
- üMODÇ
-
- Ifyouuseacounterinaloopinordertodosomethingeverytimethe
- counterreachesamultipleof10,youcoulddothisasfollows:
- IFcounterMOD10=0 !multipleof10?
- (...) !yes,dosomething
- ENDIF
- Youcouldalsouse:
- IFMOD(counter,10)=0
- (...)
- ENDIF
-
-
- üBCLRÇ
-
- InGFA-Basicversion2.xyouusedANDtoclearabit:
- x|=x|AND&X11111011 !clearbit2ofthisbyte
- Remember,thefirst(rightmost)bitisbit0,soabytecontainsbit0-7
- fromrighttoleft.InGFA-Basic3.0youclearabitsimplywith:
- x|=BCLR(x|,2) !clearbit2ofthisbyte
- Butifyouwanttoclearmorethanonebit,youshouldusetheAND-method:
- x|=x|AND&X11110000 !clearbit0-3ofthisbyte
- Inthiscaseyouuseaso-calledmasktoclearcertainbits.Youcanuse
- ANDalsoasafunction:
- y|=AND(x|,&X11110000) !evenfasterthanpreviousexample
- Thiswayyoucantestifabit-mask"fits"avariable:
- IFAND(x|,mask|)
- (...)
- ENDIF
- Anexampleofthismethod:
- IFAND(BIOS(11,-1),&X1001)
- (...) !userpressed<Alternate>+right<Shift>
- ENDIF
- üBSETÇ
-
- InGFA-Basic2.xyouneededORtosetabit,butnowyouuseBSET:
- x|=BSET(x|,1)
- YoustillneedtheOR-methodifyouwanttosetmorethanonebitfast:
- x|=x|OR&X1010 !setbit1and3
- Themask&X1010isusedtosetbits1and3.ComparethiswiththeAND-
- method,whereê0ÇisusedtoêclearÇabit,whilehereê1ÇisusedtoêsetÇabit.
- YoucanuseORnotonlyasanoperator,butalsoasafunction:
- y|=OR(x|,&X1010)
-
-
- üBCHGÇ
-
- InsteadofBCHGyoushouldusetheXOR-methodifyouwanttochangemore
- thanonebit(withamask):
- x|=x|XOR&X1110 !changebit1-3
- XORcanbeusedasafunctionaswell.
-
-
- üLOGÇ
-
- Logarithmswithabaseotherthan10orearecomputedasfollows:
- LOG(x)/LOG(base)
-
-
- üSINQandCOSQÇ
-
- IfyouaregoingtoconvertSIN(orCOS)intoSINQ(COSQ),you'llhaveto
- changefromradialstodegrees.Forexample,youwouldconvertSIN(x)to
- SINQ(DEG(x)).AlthoughSINQisaboutfivetimesfasterthanSIN,this
- extracomputationmakesthedifferencealittlelessspectacular.Ifyou
- arelucky,thevariablealreadyisindegrees,soyoucanuseSINQ
- immediately.SINQandCOSQshouldnotbeusedifyouneedveryaccurate
- results,onlyifyouplottheresultandarenotgoingtouseitfor
- furthercomputations.ExaminethedifferencebetweentheuseofSIN/COS
- andSINQ/COSQtoseeifthelessaccurateresultisacceptable.InHigh
- resolutiontrysomethinglikethis:
- fac#2*PI/639
- DRAW0,200
- FORx=0TO639
- y#=SIN(x*fac#)
- DRAWTOx,200+y#*200
- NEXTx
- ~INP(2)
- CLS
- '
- DRAW0,200
- FORx=0TO639
- y#=SINQ(DEG(x*fac#))
- DRAWTOx,200+y#*200
- NEXTx
- ~INP(2)
- CLS
- Ç '
- fac#=360/639
- DRAW0,200
- FORx=0TO639
- y#=SINQ(x*fac#)
- DRAWTOx,200+y#*200
- NEXTx
- ~INP(2)
-
-
- üEQVÇ
-
- EQVdoesn'tworkproperly.EQV(0,-1)shouldbe0,butequals-65536.The
- bits16-31arealwaysset:EQVseemstolookatthebits0-15only.
-
-
- üCARDandSWAPÇ
-
- Ifa4-byteinteger(postfix%)consistsoftwowords,youcanextract
- thesewith:
- low.word=CARD(x%)
- high.word=CARD(SWAP(x%))
- BothwordsareinterpretedasêpositiveÇnumbers.
-
- Unfortunately,thereisnoanaloguefunctiontoswapthelowandhigh
- byteofaword.Thatwouldbeusefulifyouwanttoconvertaword
- into/fromIntel-format(MS-DOS).Rotating8bitsshoulddothetrick:
- FUNCTIONintel.word(x%)
- RETURNCARD(ROR&(x%,8)) !swaplow/highbyte
- ENDFUNC
- Nowyoushouldbeabletoextractthelowandhighbyteofaword:
- low.byte|=BYTE(x)
- high.byte|=BYTE(@intel.word(x))
-
-
- üMAXÇ
-
- Thisishowyoucouldfindthehighestvalueinaword-array:
- PROCEDURE max.array(VAR proc(),high)
- ' *** return highest value of array proc()
- LOCAL last,n
- last=DIM?(proc())-1
- high=proc(1) !proc(0)ignored
- FOR n=2 TO last
- high=MAX(high,proc(n))
- NEXT n
- RETURN
- Ioftenstorespecialinformationintheelementwithindex0.
-
-
- üCorrelationÇ
-
- UsetheProcedureCorrelatetodeterminethecorrelationbetweentwo
- arrays.
- üë7.STRINGS
- Ç
-
- üINSTRÇ
-
- ThecommandINSTR(a$,b$,i)alwaysreturns'1'ifa$=b$.Fori=1that's
- fine,butnotfori>1.Don'tblameme,I'mjustthemessenger.
-
-
- üLSETandRSETÇ
-
- IfyouuseLSETorRSET,thestringispaddedwithspaces:
- a$="345"
- LSETa$="12"
- PRINTa$ !theinterpreterprints"12",ênotÇ"12345"
-
- YoucanuseRSETforrightjustificationofcolumns:
- f$=SPACE$(10)
- FORi=1TO10
- RSETf$=text$(i)
- PRINTf$
- NEXTi
-
-
- üParserÇ
-
- Parsingastring,youwillfrequentlyhavetosplitthestringintothe
- target$,thestringbeforeandthestringafterthattarget$.The
- followingfunctionscouldbehelpful:
- FUNCTION before$(source$,target$)
- ' *** returns part of source$ before target$
- ' *** returns complete source$ if no target$ found
- LOCAL p
- p=INSTR(source$,target$)
- IF p=0
- RETURN source$
- ELSE
- RETURN LEFT$(source$,p-1)
- ENDIF
- ENDFUNC
- '
- FUNCTION after$(source$,target$)
- ' *** returns part of source$ after target$
- ' *** returns nullstring if no target$ found
- LOCAL p
- p=INSTR(source$,target$)
- IF p=0
- RETURN ""
- ELSE
- RETURN MID$(source$,p+LEN(target$))
- ENDIF
- ENDFUNC
-
-
- üë8.KEYBOARDINPUT
- Ç
-
- üINKEY$Ç
-
- Allkeypressesaresavedinthekeyboard-buffer.Ifyoudon'twantINKEY$
- toreadan"old"key,youshouldfirstclearthebuffer:
- REPEAT
- UNTILINKEY$="" !clearkeyboard-buffer
- key$=""
- REPEAT
- key$=INKEY$ !waitfornewkey
- UNTILkey$<>""
-
- Inthefollowingtableyou'llfindafewusefulêdecimalÇASCII-codesyou
- canuseafter'key$=INKEY$'.InthethirdcolumntheêhexadecimalÇscan-code
- ofthekeyisalsomentioned(seeparagraph'KEYGET').
-
- êkeyÇ êASC(key$)Ç êscancodeÇ
- <Backspace> 8 &H0E
- <Tab> 9 &H0F
- <Return>and<Enter> 13 &H1Cand&H72
- <Esc> 27 &H01
- <Delete> 127 &H53
-
- êkeyÇ êASC(RIGHT$(key$))Ç
- <F1> 59 &H3B
- <F10> 68 &H44
- <Shift><F1> 84 &H54
- <Shift><F10> 93 &H5D
- <Help> 98 &H62
- <Undo> 97 &H61
- <Insert> 82 &H52
- <ClrHome> 71 &H47
- <Leftarrow> 75 &H4B
- <Rightarrow> 77 &H4D
- <Uparrow> 72 &H48
- <Downarrow> 80 &H50
-
- Keysinthesecondpartofthistablereturna2-bytevalueafterINKEY$.
- Youonlyneedthelowbyte,thehighbyteis&H00.That'swhyaStandard
- Globallikehelp$isdefinedas'CHR$(0)+CHR$(98)'.Thenit'seasyto
- checkif<Help>waspressed:
- IFkey$=help$
- (...) !<Help>
- ENDIF
- Otherwise,youhavetotestasfollows:
- IFASC(RIGHT$(key$))=98
- (...) !<Help>
- ENDIF
- However,readtheparagraph'KEYGET'fortheultimatekeypress-processor.
-
- ÇIfyouarejustwaitingforanykeypress,youcoulduseeitherofthe
- followingmethods(clearthekeyboard-bufferfirst):
- ~INP(2) !myfavourite
- '
- KEYGETcode% !perhapsthisisclearerinalisting
- '
- REPEAT !aloopisalsopossible
- UNTILLEN(INKEY$)
- ThelattermethodisneededifyouarewaitingforanykeypressêorÇany
- mouse-click:
- REPEAT
- UNTILLEN(INKEY$)ORMOUSEK
-
-
- üINPUTÇ
-
- Ifyoudon'twantthequestionmarktoappearafterINPUT,use:
- LOCATEcol,lin
- INPUT"",txt$
- Thenullstringandthecommaareessential.Mostofthetimeyou'llneed
- somethinglike:
- LOCATEcol,lin
- INPUT"Enteryourname:",name$
- Butiftheinstruction-lineisnotthesameastheINPUT-line,use:
- PRINTAT(col1,lin1);"Enteryourname:"
- LOCATEcol2,lin2
- INPUT"",name$
-
- AfterINPUT,theusercanpress<Insert>toswitchbetweenInsert-modeand
- Overwrite-mode.Ihavenotbeenabletodiscoverhowtoinputcharacter-
- codes0-31afterINPUT.It'snotimportantanyway,butIreadsomewhere
- youcoulduse<Alternate>forthispurpose.TheAlternate-methodcanbe
- usedforcharacter-codes128-255(not127).Inthefollowingtableyou'll
- findsomeimportantcharacterswiththedecimalASCII-code:ê
-
- Ç êcharacterÇ êASCII-codeÇ êcharacterÇ êASCII-codeÇ êcharacterÇ êASCII-codeÇ
-
- á - 160 é - 130 í - 161
- à - 133 è - 138 ì - 141
- ä - 132 ë - 137 ï - 139
- â - 131 ê - 136 î - 140
-
- ó - 162 ú - 163 ÿ - 152
- ò - 149 ù - 151 ß - 158
- Ö - 148 ü - 129
- ô - 147 û - 150
-
- α - 224 ≡ - 240 ½ - 171
- β - 225 ± - 241 ¼ - 172
- δ - 235 ≥ - 242 ² - 253
- µ - 230 ≤ - 243
- π - 227 ÷ - 246
- τ - 231 ≈ - 247
-
- Ç ¢ - 155 © - 189
- £ - 156 § - 221
- ƒ - 159
- IfyouwanttouseoneofthesecharactersafterINPUT,youshouldhold
- <Alternate>down,enterthecode,andrelease<Alternate>.Ihopeyour
- printer-drivercoulddigestthistable...
-
- Youcanuse<Backspace>,<Delete>,<Leftarrow>and<Rightarrow>onan
- INPUT-line,butalso:
- <Uparrow> -cursortostartofinput-line
- <Downarrow> -cursortoendofline
- <Esc> -eraseline
- Thefirsttwofeelslightlyunnatural,Iwouldpreferittheotherway:up
- toend,downtostart.
-
- BothINPUTandLINEINPUTuseaspecialcursor,soitdoesn'tmakemuch
- sensetouseXBIOS21(Curscon)todosomethinginterestingwiththeTOS-
- cursor.
-
-
- üINPUT$
- Ç
- Fortheinputofasecretpassword,youcouldusesomethinglike:
- PRINT"typepassword(5characters):";
- code$=INPUT$(5)
- Thepassworddoesnotappearonthescreen.
-
- ü
- LINEINPUTÇ
-
- LINEINPUTusestheunderscore(_)asthecursorinawindow.Afteryou
- press<Return>,theunderscoreisnotcompletelyerased.Therightmost
- pixelremainsvisible.IthinkthisisaGEM-bug.
-
-
- üKEYTESTÇ
-
- TheKEYTEST-functiondoesnotrespondtokeyssuchas<Help>,<Undo>,etc.
-
-
- üKEYGETÇ
-
- KEYGETwaitsforakeypress,justlikeINP(2).ButKEYGETisfarmore
- flexible,becauseitreturnstheASCII-codeêandÇthescan-codeofanykey
- êandÇalsothestateofthespecialkeys<Shift>,<Control>,<Alternate>and
- <CapsLock>.ConsultyourmanualfortablesofASCII-codesandscan-codes
- (intheparagraph'INKEY$'youalreadyencounteredsomeimportantcodes).
- Studythefollowingexampletogetanimpressionoftheeasywayyoucan
- examineallkeypresseswithKEYGET:
-
- Ç @initio_keyget!assignvariablestothethreecodes
- '
- DO
- KEYGETget_code%
- @keyget!processkeypressthere(notincluded)
- LOOP
- '
- PROCEDUREinitio_keyget
- ABSOLUTEascii|,V:get_code%+3
- ABSOLUTEscan|,V:get_code%+1
- ABSOLUTEstatus|,V:get_code%
- RETURN
-
- YouwillhavetowriteyourownKeyget-Procedure.Youcancheckifanyof
- thespecialkeyshasbeenpressed,byusingBTST(status|,bit):
- bit0=Right<Shift>
- bit1=Left<Shift>
- bit2=<Control>
- bit3=<Alternate>
- bit4=<CapsLock>
- Youcoulddiscoveriftheuserhadpressed<Control><Downarrow>with:
- IFscan|=&H50ANDBTST(status|,2)
- (...)
- ENDIF
-
- IfyouareêonlyÇinterestedinmonitoringthefivespecialkeys,youcould
- useBIOS11(Kbshift)aswell:
- status|=BIOS(11,-1)
- Usethesametableasabovetotestifbit0-4isset.
-
- Youareadvisedtoclearthekeyboard-bufferbeforeleavingtheProcedure
- Keyget.
-
- Inmostcasesthescan-codeofakeyisthesame,whetheryoupresseda
- specialkeysimultaneouslyornot.Butwatchoutforthefollowing
- exceptions!For<Shift><F1>to<Shift><F10>thescan-codes&H54to&H5D
- arereturned(ênotÇ&H3Bto&H44).OnanMS-DOScomputerthesecodesare
- usedforthekeysF11toF20.Thecombinations<Control><LeftArrow>
- (&H73)and<Control><RightArrow>(&H74)alsohavespecialcodes.Blame
- MS-DOS.Thecombinations<Alternate><1>to<Alternate><=>havethe
- specialcodes&H78to&H83.That'sALT1toALT=forMS-DOS.
-
-
- üKEYLOOKÇ
-
- Accordingtoanunconfirmedreport,KEYLOOKdoesnotfunctionproperly
- withthepre-BlitterTOS.
- ü
-
- üKEYPRESSÇ
-
- KEYPRESSusesthesame4-byteformatasKEYGET:&Hccss00aa.Inityou
- willrecognizetheASCII-code(&Haa),thescan-code(&Hss)andthecode
- forthespecialkeys(&Hcc).Ifyouwanttosimulatethepressingofakey
- inanAlertbox,youwillhavetosendboththeASCII-codeandthescan-
- code.Use&H1C000Dtosimulatethepressingof<Return>.Or&H04620062for
- <Control><Help>,althoughthatcertainlywon'thelpinanAlertbox.If
- youdon'tneedthescan-code(e.g.withINPUT),youcanusejustKEYPRESS
- &Haa.
-
- ü
- KEYDEF
-
- ÇTheeditoralwaysusesKEYPAD&X101110,soyouwillhavetosetbit4
- yourself(e.g.KEYPAD&X10000)beforeyouwillbeabletouseKEYDEFin
- yourprogram.
-
-
- üKeyboard
- Ç
- AsfarasIknow,therearefourdifferentkeyboardsavailable:USA
- (QWERTY),English(QWERTY),German(QWERTZ)andFrench(AZERTY).Thekey
- withscan-code&H2B(totherightof<Return>)hasadifferentASCII-code
- ineachversion:
- êversionÇ êASCII-codeÇ êcharacterÇ
- USA &H5C (92) \
- English &H23 (35) #
- German &H7E (126) ~
- French &H40 (64) @
- YoucoulduseXBIOS16(Keytbl)todeterminethekeyboard-version:
- PROCEDURE keyboard.version
- SELECT PEEK(LPEEK(XBIOS(16,L:-1,L:-1,L:-1))+&H2B)
- CASE &H5C
- usa.keybrd!=TRUE
- CASE &H23
- english.keybrd!=TRUE
- CASE &H7E
- german.keybrd!=TRUE
- CASE &H40
- french.keybrd!=TRUE
- ENDSELECT
- RETURN
-
- Youshouldtakeintoaccountthedifferencesbetweenthekeyboard-versions
- ifyouarewritingaprogramthatshouldrunsmoothlyinanycountry.
-
- ÇInthefollowingtableIhavegatheredallkeysthathaveênotÇthesame
- meaningonthefourkeyboard-versions:
-
- êscancodeÇ êUSAÇ êEnglishÇ êGermanÇ êFrenchÇ
- &H0C - - ß )
- &H0D = = - '
- &H10 Q Q Q A
- &H11 W W W Z
- &H15 Y Y Z Y
- &H1A [ [ Ü [
- &H1B ] ] + ]
- &H1E A A A Q
- &H27 ; ; ö M
- &H28 ' ' Ä \
- &H29 ` ` # `
- &H2B \ # ~ @
- &H2C Z Z Y W
- &H32 M M M ,
- &H33 , , , ;
- &H34 . . . :
- &H35 / / - =
- &H60 none \ < <
-
- Ifyouaregoingtouseanyscan-codefromthistable,youshouldbevery
- careful.It'snotnicetoaskaGermanusertopress<Y>,buttestfor
- scan-code&H15inyourprogram...
-
- Ifyouinsistondoingthingsthehardway,youcanfindtheASCII-value
- thatisassignedtoakeywithXBIOS16.Actuallytherearethreetables:
- oneforanormalkeypress,oneforashiftedkeyandoneforakeypress
- withCapsLockon:
- keytbl%=LPEEK(XBIOS(16,L:-1,L:-1,L:-1))
- shift%=keytbl%+&H80
- capslock%=shift%+&H80
- NowyoucanfindtheASCII-codeforanyscan-code(<&H80):
- ascii=PEEK(keytbl%+scancode) !normalkey
- ascii=PEEK(shift%+scancode) !shiftedkey
- ascii=PEEK(capslock%+scancode) !CapsLockon
-
-
- üKeyclick,KeyrepeatandCapsLockÇ
-
- Normally,youneedtheKeyclickasanaudiblefeedback.Sometimesyouhave
- toswitchtheKeyclickoff,e.g.whileanXBIOS32songisplaying:
- PROCEDURE key.click(switch!)
- IF switch!
- SPOKE &H484,BSET(PEEK(&H484),0) ! keyclick on
- ELSE
- SPOKE &H484,BCLR(PEEK(&H484),0) ! keyclick off
- ENDIF
- RETURN
-
- ÇIfyourprogramreactsslowlyafterakeypress,youprobablyhaveto
- switchtheKeyrepeattemporarilyoff:
- PROCEDURE key.repeat(switch!)
- IF switch!
- SPOKE &H484,BSET(PEEK(&H484),1) ! key-repeat on
- ELSE
- SPOKE &H484,BCLR(PEEK(&H484),1) ! key-repeat off
- ENDIF
- RETURN
-
- YoucanswitchCapsLockonoroffwith:
- PROCEDURE caps(switch!)
- IF switch!
- ~BIOS(11,BSET(BIOS(11,-1),4)) ! CapsLock on
- ELSE
- ~BIOS(11,BCLR(BIOS(11,-1),4)) ! CapsLock off
- ENDIF
- RETURN
-
-
-
- üë9.SCREENOUTPUT
- Ç
-
- üPRINTÇ
-
- ItisveryimportanttoknowifPRINTwillbeusedontheso-calledTOS-
- screen(nowindowsopened),orinawindow.TOSemulatestheVT52-terminal
- ofDigitalEquipment,soifyouPRINTontheTOS-screen,theVT52-codes
- willbeinterpretedascommands.Butinawindowthesecodesareprinted
- ascharacters!
-
- InbothHighandMediumresolutionyoucanPRINT25linesof80
- characters,butinLowresolutionit's25linesof40charactersonly.
-
- Normallyyoucan'tPRINTacharacteratposition(80,25)inHighorMedium
- resolution,orat(40,25)inLowresolution.Trythefollowing:
- PRINTAT(80,25);"X";
- andyouwillseethatalinefeedisexecutedautomatically,inspiteof
- thesemicolonafter"X".OntheTOS-screenyoucanputacharacteratthis
- positionbyusingtheVT52-command'wrapoff':
- PRINTAT(80,25);"*wX"; !usetheEscape-characterinsteadof*
- After'Escw'thelinefeedissuppressed.Theeasiestwaytoenterthe
- Escape-characterintheGFA-editoristohold<Alternate>downandthento
- enter<2><7>.IfyouPRINTastringthatdoesn'tfitonthecurrentline,
- theremainingcharactersareeitherprintedonthenextline('Escv',the
- defaultintheinterpreter,ênotÇinacompiledprogram),ordiscarded
- ('Escw').Actually,after'Escw'allcharactersuptothefirstCHR$(10)
- orCHR$(13)arediscarded.
-
- It'simpossibletoPRINTcharacterswithASCII-code0-31ontheTOS-
- screen.However,youcanprintanycharacterwith:
- OUT5,code
- Ifnecessary,useLOCATEfirst.
-
- Afteropeningawindow(OPENWx)thecommandDEFTEXTwillchangesizeand
- colourofPRINTedtextaswell!OneadvantageisthatyoucannowPRINTin
- differentcoloursonthescreen.
-
- OntheTOS-screen,allPRINTedtexthasthesamecolour.Thiscolouris
- determinedbycolour-index1andisalsousedfortheAlert-boxandthe
- Fileselector.Thebackgroundonthescreenisdeterminedbycolour-index
- 0.ThiscolourisusedafterCLS.
-
- ItispossibletoPRINTindifferentcoloursontheTOS-screen,byusing
- theVT52-code'Escb'.ThebackgroundofPRINTedtextcanbechangedwith
- VT52-code'Escc'.Usethefollowingfunctionstoexperiment:
- DEFFNink$(color)=CHR$(27)+"b"+CHR$(color)
- DEFFNpaper$(color)=CHR$(27)+"c"+CHR$(color)
- Usethecolour-tablefromtheparagraph'SETCOLOR'orbepreparedto
- becomeveryfrustrated.IusetheStandardArraycolor.index()asthe
- colour-tableinmyprograms,soIchangethecolourofthePRINTedtextor
- theback-groundwiththeStandardFunctions:
- DEFFNink$(color)=CHR$(27)+"b"+CHR$(color.index(color))
- DEFFNpaper$(color)=CHR$(27)+"c"+CHR$(color.index(color))
- ÇRemember,theVT52-codeshavetobePRINTedtobecomeeffective,like
- this :
- PRINT@ink$(red);@paper$(green);"thistextiseye-catching"
- Notethespacesatbeginningandendofthestringtoemphasizethetext-
- colouragainstthebackground-colour.Ofcourseyouhavetodeclarethe
- variablesredandgreenfirst(usuallycolour-index2and3;orifyou
- don'tusetheVDIcolour-index,trythenumbers1and2).Idefinethe
- defaultcoloursasStandardGlobalsinmyprograms.BeforeIforget,it
- won'tworkinHighresolution.Sorry,couldn'tresistthatone.
-
- InordertocatchtheeyeoftheuserinHighresolutionyoucanPRINT
- reverseontheTOS-screen:
- PRINT"thisis*pIMPORTANT*q" !enterEscinsteadof*
- EntertheEscape-characterintheusualway.Noteagaintheextraspace
- bothbeforeandafterthewordthatshouldstandout.Ofcourseyoucould
- alsouseCHR$(27):
- PRINT"thisis";CHR$(27);"pIMPORTANT";CHR$(27);"q"
- Moredifficulttoreadonthescreen,buteasiertoLlist.Iusethe
- StandardFunctionRev$inallprograms:
- DEFFN rev$(txt$)=CHR$(27)+"p"+txt$+CHR$(27)+"q"
-
- IfyouuseacommawithPRINT,thecursorwilljumptothenexttabulator-
- stop.Tab-stopsareatposition1,17,33,49and65.Trythefollowingto
- seewhatImean(inHighorMediumresolution):
- PRINT"1","17","33","49","65","1","17"
- Ifyouusethecommaafterthelasttab-stop,alinefeedisexecutedand
- thecursorjumpstothefirsttab-stoponthenextline.
-
- Theeasiestwaytousedoublequotesisbyusingdoubledoublequotes
- (readthistwicetomakesureyouunderstandit):
- PRINT"doublequotesprintedthe""easy""way"
- InaDATA-lineasingledoublequotesuffices:
- DATA"lookMa,"doublequotes"again"
- Or,simply:
- DATAlookMa,"doublequotes"again
-
- TrytheProcedureFastprintinHighresolutionifyoufindPRINTtooslow.
- ThisProcedureprintsaboutfourtimesfaster!VT52-commandsareignored,
- becausecharactersarecopiedstraightfromthefont-tabletothescreen.
-
-
- üLOCATEÇ
-
- ThesyntaxofPRINTATandLOCATEisnowlessconfusing:
- PRINTAT(column,line)
- LOCATEcolumn,line
- InolderversionsofGFA-BasicitwasLOCATEline,column.Checkthisif
- yourunanoldprogramandtextisPRINTedonthewrongplace.
-
-
- üPRINTTABÇ
-
- PRINTTABbehavesstrangelyifthepositionisgreaterthan80.Trythe
- followinginHighorMediumresolution:
- FORi=0TO30
- PRINTTAB(i*20);i;
- NEXTi
- Onewaytosolvethisproblemis:
- PRINTTAB(MOD(i*20,80));i; !dousesemicolons
- ButIthinkthisisaGFA-bugthatprobablywillbecorrectedinfuture
- versions.
-
- YoucancombineTABwithPRINTATandwithPRINTUSING:
- PRINTAT(1,1);"1";TAB(40);"40"
- PRINTTAB(40);USING"##",40
-
-
- üSetscreen(XBIOS5)
-
- ÇWithXBIOS5(Setscreen)itispossibletochangetheresolutionfromLow
- toMediumandfromMediumtoLow.Unfortunately,GEMignorestheswitch,
- soGEM-commands(e.g.ALERT,TEXT,MOUSE)donotworkproperly!Butyou
- couldchangefromLowtoMediumresolutiontoshowtextontheTOS-screen
- withPRINT(andVT52-commands).Mostuserswillbegratefulforthe
- improvedreadabilityofthetext:
- ~XBIOS(5,L:-1,L:-1,1) !switchfromLowtoMedium
- (...) !printtextinMediumresolution
- ~XBIOS(5,L:-1,L:-1,0) !andgobacktoLow
- Ifyouchangetheresolution,theVT52-emulatorisautomatically
- initialised.You'llprobablyhavetoadjustthepalettebeforeyoucan
- readthetextwithoutsun-glasses.Don'tforgettosaveandrestorethe
- oldpalette.
-
- XBIOS5isveryusefulifyouwouldliketodrawonascreenbefore
- showingittotheuser.Drawingonan"invisible"screenisindeed
- possible,becausetheoperatingsystemusestwoscreens:thephysical
- screen(visibleonyourmonitor)andthelogicalscreen(usually,butnot
- necessarily,thesameasthephysicalscreen).Allgraphical(GEM-)com-
- mands,includingtheTEXT-command,arealwayssenttothelogicalscreen.
- ButTOSwillsendPRINT-commandstotheêphysicalÇscreen,unlessyou've
- openedawindow!Iftheaddressoflogicalandphysicalscreenisnotthe
- same,youhaveyourinvisiblescreen(exceptforPRINTingontheTOS-
- screen).TheaddressofthelogicalscreenêmustÇbeamultipleof256.
- StudytheProceduresInitio.logical.screen,Swap.screenand
- Restore.physical.screentoseehowyoucouldusethedescribedmethodfor
- animation:
- PROCEDURE initio.logical.screen
- ' *** global : SCREEN.1% SCREEN.2%
- DIM screen.2|(32256)
- screen.2%=VARPTR(screen.2|(0))
- screen.2%=screen.2%+256-(screen.2% MOD 256)
- screen.1%=physbase%
- ~XBIOS(5,L:screen.2%,L:-1,-1) ! invisible screen.2 is now active
- RETURN
- Ç '
- PROCEDURE swap.screen
- ' *** physical and logical screen are swapped
- SWAP screen.1%,screen.2%
- VSYNC ! avoid flash
- ~XBIOS(5,L:screen.2%,L:screen.1%,-1) ! swap the screens
- RETURN
- '
- PROCEDURE restore.physical.screen
- ~XBIOS(5,L:physbase%,L:physbase%,-1)
- RETURN
-
- OnsomeST-computersXBIOS5doesnotfunctionproperlyafterinstallation
- ofaRAM-disk.Inthatcaseyoucouldchangetheaddressofthelogical
- screenwith:
- VSYNC
- SLPOKE&H45E,adr%
-
-
- üFontÇ
-
- TOShasthreebuilt-insystem-fonts.ThedefaultPRINT-fontforHigh
- resolutionisthe8x16font(equalsDEFTEXT,,,13forTEXT),whilethe8x8
- font(equalsDEFTEXT,,,6)isusedinMediumandLowresolution.Youcan
- switchbetweenthesetwofontswiththefollowingProcedures:
- PROCEDURE font.8x16
- LOCAL a$,adr%
- a$=MKI$(&HA000)+MKI$(&H2009)+MKI$(&H4E75)
- adr%=VARPTR(a$)
- adr%=C:adr%() ! address of font-table
- {INTIN}={adr%+8} ! pointer to 8x16 system-font
- VDISYS 5,2,0,102
- RETURN
- '
- PROCEDURE font.8x8
- LOCAL a$,adr%
- a$=MKI$(&HA000)+MKI$(&H2009)+MKI$(&H4E75)
- adr%=VARPTR(a$)
- adr%=C:adr%() ! address of font-table
- {INTIN}={adr%+4} ! pointer to 8x8 system-font
- VDISYS 5,2,0,102
- RETURN
- BothProceduresseemtohaveproblemswiththeaccessoryQUICKST,butI
- neveruseitwithGFA-Basicbecausethereareotherproblems(INPUT)as
- well.IfIdon'tuseit,howdidIdiscoverthis?Goodquestion.Thethird
- fontisusedforicons,butforsomereasoncannotbecomethecurrent
- system-font.TheVDI-functionseemstoworkonlywithfontscontaining
- charactersofwidth8pixels.Thefunctionisnotofficiallydocumented
- byAtari(?).
-
- ÇYoucanreplacethesystem-fontbyafontthathasbeencreatedwith
- FONTKITbyJeremyHughes(4114byteA1_xxxxx.FONfileforHigh
- resolution).UsetheProcedureChange.fontforthispurposeandcallthe
- ProcedureNormal.fonttorestoretheoriginalsystem-font:
- PROCEDURE change.font
- ' *** global : NEW.FONT! NORMAL.FONT%
- LOCAL adr%,new.font%
- '
- ' *** load A1_xxxxx.FON file (4114 bytes) here
- INLINE new.font%,4114
- '
- adr%=L~A-22
- normal.font%={adr%}
- SLPOKE adr%,new.font%
- new.font!=TRUE
- RETURN
- '
- PROCEDURE normal.font
- IF new.font!
- SLPOKE L~A-22,normal.font%
- new.font!=FALSE
- ENDIF
- RETURN
- IhavenotyetdiscoveredhowtouseaFONTKIT-fontwithTEXT.Yes,I
- couldloadanewfontafterinstallingGDOS,butthat'snotwhatI'm
- lookingfor.Isthereaquickandnot-dirtywaytoconvinceGEMthatanew
- fonthasbeeninstalled?
-
- Afont-tableforthe8x16fontoccupies4096bytes(16bytes/character,
- 256characters).AFONTKIT-fontusuallyhasanameattachedattheend,
- that'swhyIreserve4114bytes.TOSignoresthenamecompletely,it's
- onlyusedbytheaccessoryFONSEL.ACC.Youcanloadany4096-bytefontin
- theProcedureChange.font,youdon'tevenhavetochange4114into4096.
- Althoughyoulose18bytesifyoudon't.
-
-
- üë10.PRINTER
- Ç
-
- üPrinterreadyÇ
-
- Ifyousenddatatoyourprinter(HARDCOPY,LPRINT,etc.),yourSTwill
- wait30looooooongsecondsiftheprinterhappenstobenotready.Always
- checkiftheprinterisreadybeforesendingdatatotheprinter,e.g.by
- callingthefollowingProcedure:
- PROCEDUREprinter.ready
- LOCALk
- DO
- EXITIFGEMDOS(17)
- ALERT3,"printer||notready!!",1,"OK",k
- LOOP
- RETURN
-
-
- üHARDCOPYÇ
-
- YoucansendascreendumptotheprinterbyusingthecommandHARDCOPYor
- bypressing<Alternate><Help>.InêbothÇcasesyoucanabortthescreendump
- bypressing<Alternate><Help>.
-
- YoucanuseCONTROL.ACCtochangetheprinter-parameters.Don'tforgetto
- savethedesktop,inordertostoretheseparametersinthefile
- DESKTOP.INF.Lookfor'#b'withyourdisk-editorifyou'recurious.The
- parameterswillonlybereadfromDESKTOP.INFifCONTROL.ACCisinstalled
- afterareset!IsuggesttheuseofXBIOS33(Setprt)inaprograminstead
- ofusingCONTROL.ACC.ForascreendumpfromtheHighresolutionscreento
- anEpson-compatibleprinter,clearbit1andsetbit2:
- PROCEDUREscreendump
- ~XBIOS(33,&X100) !screendumptoEpson(-compatible)printer
- HARDCOPY
- RETURN
- Ifyousetbit2,TOSassumesyouconnectedanEpson-printer(960
- pixels/line).Clearbit2andTOSassumesyouhaveanAtari-printer(1280
- pixels/line).
-
- IfyouuseHARDCOPY,thewidth/heightratiooftheprintoutdoesnot
- correspondwiththatofthescreen.Forareasonablyfast1:1screendump,
- studytheProcedureHigh.screendump.epson(EpsonFX-80,orother9-pin
- Epson-compatibleprinter)ortheProcedureHigh.screendump.star24(24-pin
- StarLC24-10):
- PROCEDURE high.screendump.star24
- LOCAL m$,b$,k,scrn.start%,col,b%,x,d%,p|,b1|,b2|,b3|,n
- lf$=CHR$(10)
- ff$=CHR$(12)
- DEFFN bit.image$(m,d)=CHR$(27)+"*"+CHR$(m)+CHR$(MOD(d,256))+
- CHR$(d/256)
- DEFFN line.space$(n)=CHR$(27)+"3"+CHR$(n)
- initialize$=CHR$(27)+"@"
- scrn.start%=XBIOS(2)
- '
- Ç LPRINT initialize$;
- FOR col=0 TO 79
- b%=scrn.start%+col
- LPRINT SPC(8);
- LPRINT @line.space$(24);
- LPRINT @bit.image$(33,800);
- FOR x=399 TO 0 STEP -1
- d%=ADD(b%,MUL(x,80))
- p|=BYTE{d%}
- IF p|=0
- OUT 0,0,0,0,0,0,0
- ELSE
- CLR b1|,b2|,b3|
- IF BTST(p|,0)
- b1|=7
- ENDIF
- IF BTST(p|,1)
- ADD b1|,56
- ENDIF
- IF BTST(p|,2)
- ADD b1|,192
- b2|=1
- ENDIF
- IF BTST(p|,3)
- ADD b2|,14
- ENDIF
- IF BTST(p|,4)
- ADD b2|,112
- ENDIF
- IF BTST(p|,5)
- ADD b2|,128
- b3|=3
- ENDIF
- IF BTST(p|,6)
- ADD b3|,28
- ENDIF
- IF BTST(p|,7)
- ADD b3|,224
- ENDIF
- OUT 0,b3|,b2|,b1|,b3|,b2|,b1|
- ENDIF
- NEXT x
- LPRINT
- EXIT IF INKEY$=esc$
- NEXT col
- LPRINT ff$;
- LPRINT initialize$;
- RETURN
-
- Foramoreflexibleapproach,studytheProcedureDegas.screendump(Star
- LC24-10,possibleformats:27x17,18x11,13.5x8.5or9x5.5cm).
-
- ÇItshouldbepossibletosendonlya(GET-)rectangletoyourprinterwith
- XBIOS36(Prtblk)orV_OUTPUT_WINDOW(VDI5,Escape21).Anybodyoutthere
- whoknowshow?
-
- Never,Irepeat,êneverÇswapdisksduringascreendump,asthiscouldbe
- fatalforthenewdisk.TOSignoresthewrite-protectstateduringa
- screendump,soitwillmissthedisk-swapcompletely.TOSwillusetheold
- FATforthenewdisk,andthatusuallyisfatal(nopunintended).
-
- IfyouhaveinstalledaGFA-Basicprinter-driver(e.g.PTEPSON.PRG),a
- screendumpseemstobeimpossible.Thebit-imagemodeoftheprintercan't
- beusedafterthedriverhasbeeninstalled.
-
-
- üPrinter-commandsÇ
-
- Mostmatrix-printersrecognizeeitherIBM-orEpson-commands(orboth).I
- usethefollowingProceduretodefinethemostimportantprinter-commands
- formyStarLC24-10.Adaptthedefinitionstoyourownprinter,butstick
- tothenamesfortheglobalvariablesandfunctions.Otheruserscould
- thenuseyourprogramseasilyafterreplacingtheProcedureInitio.printer
- withtheirown:
- PROCEDURE initio.printer
- ' *** initializes global printer-variables for Star LC24-10
- ' *** DIP-switch settings :
- ' 1-1 OFF 2-1 ON
- ' 1-2 ON 2-2 ON
- ' 1-3 OFF 2-3 ON
- ' 1-4 ON 2-4 ON
- ' 1-5 ON 2-5 OFF
- ' 1-6 ON 2-6 OFF
- ' 1-7 ON 2-7 ON
- ' 1-8 ON 2-8 ON
- '
- LOCAL c$,f$
- c$=CHR$(27)
- f$=CHR$(28)
- '
- draft.char$=c$+"x0"
- lq.char$=c$+"x1"
- '
- courier.style$=c$+"k0"+lq.char$
- prestige.style$=c$+"k2"+lq.char$
- orator.style$=c$+"k3"+lq.char$
- script.style$=c$+"k4"+lq.char$
- '
- normal.char$=c$+"q0"
- outlined.char$=c$+"q1"
- shadow.char$=c$+"q2"
- outlined.shadow.char$=c$+"q3"
- '
- italic.on$=c$+"4"
- italic.off$=c$+"5"
- '
- Ç emphasized.on$=c$+"E"
- emphasized.off$=c$+"F"
- '
- underline.on$=c$+"-1"
- underline.off$=c$+"-0"
- '
- bold.draft$=draft.char$+emphasized.on$+double.on$
- bold.lq$=lq$+double.on$
- bold.off$=emphasized.off$+double.off$
- '
- superscript.on$=c$+"S0"
- superscript.off$=c$+"T"
- subscript.on$=c$+"S1"
- subscript.off$=c$+"T"
- '
- epson.set$=c$+"t0"
- ibm.set$=c$+"t1"+c$+"6"
- DEFFN special.on$(n)=c$+"\"+CHR$(MOD(n,256))+CHR$(DIV(n,256))
- DEFFN ibm.special$(n)=c$+"^"+CHR$(n)
- DEFFN epson.special$(n)=ibm.set$+@ibm.special$(n)+epson.set$
- '
- pica$=c$+"P"
- '
- elite$=c$+"M"
- '
- condensed.on$=CHR$(15)
- condensed.off$=CHR$(18)
- '
- large.on$=c$+"W1"
- large.off$=c$+"W0"
- large.line$=CHR$(14)
- '
- courier.proportional$=courier.style$+c$+"p1"
- prestige.proportional$=prestige.style$+c$+"p1"
- proportional.off$=c$+"p0"
- '
- DEFFN master.mode$(n)=c$+"!"+CHR$(n)
- underline=128
- italic=64
- expanded=32
- LET double.strike=16
- emphasized=8
- condensed=4
- proportional=2
- elite=1
- '
- normal.size$=c$+"h"+CHR$(0)
- LET double.size$=c$+"h"+CHR$(1)
- quad.size$=c$+"h"+CHR$(2)
- LET double.height$=c$+"w1"
- normal.height$=c$+"w0"
- normal.width$=f$+"E"+CHR$(0)
- LET double.width$=f$+"E"+CHR$(1)
- triple.width$=f$+"E"+CHR$(2)
- Ç '
- lf$=CHR$(10)
- DEFFN lf$(n)=c$+"f1"+CHR$(n)
- rev.lf$=c$+CHR$(10)
- '
- ff$=CHR$(12)
- rev.ff$=c$+CHR$(12)
- '
- justify.left$=c$+"a0"
- justify.right$=c$+"a2"
- justify.full$=c$+"a3"
- center$=c$+"a1"
- '
- reset$=c$+"@"
- '
- RETURN
- Ofcourseyoucoulddeleteallvariablesyoudon'tneedinyourprogram.
- Anditreallywouldbeniceifeveryoneusestheproposednames.Oneof
- thestrongpointsofPublicDomainGFA-programsisthatit'seasytoadapt
- aprogram.Orrather,itshouldbeeasy.UsingtheaboveProcedureisone
- stepintherightdirection.
-
-
- üë11.FILES
- Ç
-
- üFloppyWriteTestÇ
-
- YouareadvisedtoswitchtheWriteVerifytestoff:
- SPOKE&H444,0 !testoff
- SPOKE&H444,1 !teston(default)
- AccordingtoexpertslikeDaveSmallandBillWilkinsontheVerifytestis
- acompletewasteofvaluabletimeifyouwritetoadisk.
-
-
- üStepRateÇ
-
- Youwillfindthecurrentstep-rateofyourdrivewith:
- PRINTDPEEK(&H440)
- Thefollowingvaluesarepossible:
- 0-6ms
- 1-12ms
- 2-2ms
- 3-3ms(default)
- Theoperatingsystemonlylooksatthisvalueafterareset(?).Foran
- external5.25"-driveyouprobablyhavetouse12ms.
-
-
- üRAM-disk
- Ç
- DriveDisoftenreservedforaRAM-disk.GFAwillrecognizeaRAM-disk
- withDFREE(4)onlyifitwasalreadypresentatthetimetheinterpreter
- wasloaded.
-
- Afterswitchingoffyour1040STyoushouldwaitatleast15seconds
- beforeswitchingonagain.OtherwiseanoldRAM-disk(orsomethingelsein
- RAM,e.g.avirus...)maystillbepresentwhenyouswitchyourcomputer
- onagain.
-
- IfaRAM-diskisnotinstalledproperlyafterareset,thereasoncouldbe
- hiddeninthedrivebit-tableat&H4C2.TheoldTOSdoesnotclearthis
- tableandaRAM-diskcanonlybeinstalledasdriveDifbit3iscleared.
- Bytheway,usedriveC(bit2)êonlyÇforaharddisk.
-
-
- üDIR$()Ç
-
- UseGEMDOS25(Dgetdrv)tofindthecurrentdriveandcombinethiswith
- DIR$(drive)tofindthecurrentpath:
- drive=GEMDOS(25) !drive0-15
- drive$=CHR$(65+drive) !driveA-P
- p$=DIR$(drive+1)
- IFp$=""
- path$=drive$+":\" !maindirectory
- ELSE
- path$=drive$+":"+p$+"\"
- ENDIF
- ÇWithDIR$(0)you'llfindthepathoftheêcurrentÇdrive,notnecessarily
- driveA.DIR$(1)returnsthepathofdriveA.GEMDOSremembersthelast
- usedpathforallavailabledrives.SeealsotheStandardProcedure
- Get.path.
-
- IfyourunGFA-BasicfromthemaindirectoryandloadaGFA-programfroma
- folder,DIR$(0)willreturnthenullstring(""),notthefolder.After
- usingCHDIRwiththefolder-name,thecorrectpathwillbereturned.Iuse
- CHDIRintheShell-programs,sotheStandardGlobaldefault.path$will
- containthepathoftheGFA-program.Thismakeslifeeasierifyouwantto
- loaddata-filesfromthesamefolder,butdon'tknowtheprecisepathwhen
- youwritetheprogram.Itwouldbeniceifyoucoulddeterminethepathof
- therunningGFA-programintheprogramitself.
-
- Youcanmakeanarray-tableofavailabledriveswiththeaidofBIOS10
- (Drvmap):
- DIMdrive!(15)
- SELECTDPEEK(&H4A6)
- CASE1
- drive!(0)=TRUE
- CASE2
- drive!(0)=TRUE
- drive!(1)=TRUE
- ENDSELECT
- table%=BIOS(10)
- FORn=2TO15
- IFBTST(table%,n)
- drive!(n)=TRUE
- ENDIF
- NEXTn
-
- Youcancheckifaharddiskisconnectedwith:
- IFPEEK(&H472)<>0
- harddisk!=TRUE
- ENDIF
-
-
- üDIRÇüandFILESÇ
-
- AfterDIR,FILES,TRONorDUMPyoucanslowdownthescrollingwith
- <CapsLock>.Youcantemporarilystopthescrollingbyholdingdownthe
- right<Shift>-key.TheoutputafterDIRfitsonanyscreen,buttheFILES-
- outputistoowideforLowresolution.DIRwillshowonlyêfilesÇinthe
- currentdirectory.FILESwillalsoshowêfoldersÇ(markedwith*).WithDIR
- (andFILESELECT)youwillnotbeabletosee"hidden"filesor"system"
- files,butFILESwillshowallfiles.Youcanalsosearchforhidden
- and/orsystemfileswithFSFIRSTandFSNEXTbysettingbit1and/orbit2
- oftheattribute-byte.
-
- PerhapsyouhavenoticedthatafterthecommandFILESthefirsttwolines
- arepeculiarifyouhappentobeinafolder.Thefirst"name"inafolder
- isalways'.'(onedot)andthesecondalways'..'(twodots).Timeand
- dateareincorrect,becausetheauthorsof(theold)TOSforgottoconvert
- thesetoMS-DOSformat.Incaseofnestedfolders,theoperatingsystem
- Çfindstheprecedingfolderthroughapointerofthe'..'-file.That'swhy
- youcanuse'CHDIR..'toreturntotheprecedingfolder.Don'ttrythis
- inthemaindirectory,oryou'llgetanerror.
-
-
- üFSFIRSTandFSNEXTÇ
-
- TheDTA-bufferisusuallyfoundatBASEPAGE+128(it'salwaysthereafter
- start-up),butyoushouldnotcountonit.UseFGETDTA()tofindthe
- currentaddress,beforeFSFIRST:
- dta.adr%=FGETDTA()
- e%=FSFIRST(format$,attr)
- FSFIRSTreturns-33ifnofilehasbeenfound.FSNEXTreturns-49ifno
- morefilesarefound.
-
- Inanaccessoryit'ssafertocreateanewDTA-buffer:
- old.dta%=FGETDTA() !oldbuffer
- dta$=STRING$(44,0)
- dta.adr%=V:dta$
- ~FSETDTA(dta.adr%) !newbuffer
- (...) !FSFIRST/FSNEXT
- ~FSETDTA(old.dta%) !restoreoldbuffer
- TheDesktopwillappreciateallthisextrawork.
-
- The44byteDTA-buffer(DataTransferAddress)containsthefollowingdata
- afterasuccesfulFSFIRSTorFSNEXT:
- êoffsetÇ
- 0-20 -reserved
- 21 -attribute-byte
- 22-23 -time
- 24-25 -date
- 26-29 -file-length
- 30-43 -filename(includingtheextension,terminatedby&H00)
- Theattributesandthefilenamecanbereadfromthebufferwith:
- attr=BYTE{dta.adr%+21}
- file$=CHAR{dta.adr%+30}
-
- TheDTA-bufferisnotanexactcopyoftherelevantinformationinthe
- directoryofthedisk.Withadisk-editoryouwouldfindaslotof32
- bytesforeachfileorfolder:
- êoffset
- Ç 0-7 -file-orfolder-name(withoutextension)
- 8-10 -extension
- 11 -attribute-byte
- 12-21 -reserved
- 22-23 -time
- 24-25 -date
- 26-27 -FAT-pointer
- 28-31 -file-length
- ÇThefirstbyteofthefilenamehasaspecialmeaninginthefollowing
- cases:
- &H00 -freeslot,neverusedbefore
- &HE5 -erasedfile,nowfreeslot
- &H2E -subdirectory
- BothtimeanddatearestoredinMS-DOSformat.ConsultyourGFA-manual
- formoreinformation.TheFAT-pointer,alsoinanMS-DOSformat(Intel-
- format :firstlowbyte,thenhighbyte),pointstothefirstclusterof
- thefile.Ifyouarelookingatafolder,theFAT-pointerpointstothe
- clusterwhereyouwillfindthedirectoryofthisfolder(subdirectory).
- Ifyouarelookingatasubdirectory(i.e.youareêinÇafolder),thefirst
- twoslotsarereservedforthefiles'.'and'..'(&H2Eand&H2E2E).This
- hasalreadybeenmentionedintheparagraph'DIRandFILES'.Finally,the
- file-lengthisstoredin,youguessedit,MS-DOSformat.Youmightwonder
- whatMS-DOShastodowithAtari-disks.Readtheparagraphs'DiskFormat'
- and'FileAllocationTable'fortheexplanation.
-
- Ifyouusetheattribute-byte&X10000youwillfindbothfoldersêandÇ
- files!Ifthefoldersinadirectorydon'thaveanextensionandallfiles
- dohaveanextension,youcouldfindallfoldersinthemaindirectoryas
- follows:
- e%=FSFIRST("\*",&X10000) !ande%=FSNEXT()fornextfolders
-
- Ifyoucan'tusethissimplemethod,you'llhavetocheckaftereach
- successfulFSFIRST/FSNEXTifit'safolderorafile:
- IFBTST(BYTE{dta.adr%+21},4)
- (...) !yes,it'safolder
- ENDIF
-
- Usetheattribute-byte0(i.e.nobitsset)tofindordinaryfilesonly.
-
- Useattribute-byte&X1000tofindthedisk-name:
- dta.adr%=FGETDTA()
- e%=FSFIRST("\*.*",&X1000) !findsdisk-nameonly,ênotÇfiles
- disk.name$=CHAR{dta.adr%+30}
-
- YoucanreadtheattributesofafileorfolderwithGEMDOS67(Fattrib):
- attr%=GEMDOS(67,L:V:filename$,0,0)
- Ifthefile(orfolder)isnotfound,attr%is-33(or-34),otherwise
- attr%containstheattributesintheusualformat.Youcanevenchangethe
- attributesoffileswith:
- r%=GEMDOS(67,L:V:filename$,1,attribute%)
- It'snotpossibletochangetheattributesoffoldersorthedisk-name
- withGEMDOS67.Onewaytodothatistochangethedirectory-sectorwith
- theaidofBIOS4(Rwabs).Ifyoureallyfeeltheurgetoexperiment,you
- shouldrealizethatonetinymistakecouldruinthedisk.
-
-
- üEXISTÇ
-
- YoucanuseEXISTtotestifafolderexists,butonlyifthefolder
- containsatleastonefile:
- IFEXIST("\FOLDER\*.*")
- (...) !folderfound
- ELSE
- (...) !foldernotfoundêorÇemptyfolder
- ENDIF
-
-
- üLOFÇ
-
- ThelengthofafileiseasilydeterminedwithLOF:
- OPEN"I",#1,file$
- length%=LOF(#1)
- CLOSE#1
-
- Todeterminethenumberofrecordsinarandomfileyoucoulddividethe
- file-lengthbythetotalFIELD-length.
-
-
- üTOUCHÇ
-
- UsethismethodwithTOUCH:
- OPEN"U",#1,file$
- TOUCH#1
- CLOSE#1
-
-
- üNAMEÇ
-
- WiththeoldTOSyoucanonlychangethenameoffiles,ênotÇoffolders.
- Evenfromthedesktopyoucan'tchangethenameofafolder,sochooseit
- carefully.
-
-
- üKILLÇ
-
- KILLingafiledoesnoteraseitfromthedisk.Thefirstbyteofthe
- filenameischangedto&HE5.Unfortunatelyyoucan'trestoreakilledfile
- bysimplychangingthisbytewithadisk-editor.Theoperatingsystemwill
- beabletofindthefirstclusteroftherestoredfile,becausethefirst
- FAT-pointerislocatedinthedirectory.Thenextclusterscanonlybe
- foundthroughtheFAT(FileAllocationTable),butafterKILLallpointers
- tothisfileareirreversiblyerased.Ifyouhavenotkilledanyfileon
- thediskbeforeyourfatalmistake,youareextremelyluckyandwillfind
- allclustershavebeenstoredconsecutively.Butaftersomekillingand
- savingonthedisk,thefilecouldbedispersedovertheentiredisk.Some
- programsareabletohelpyou,butyouwillhavetorecognizeclustersas
- belongingtothekilledfile.That'seasywithASCII-files,butalmost
- impossiblewithotherfiles.So,don'tKILLunlessyouhaveto.
-
-
- üFileCopyÇ
-
- Youcancopyafilesource$todest$(usecompletepathnames!)with:
- PROCEDURE file.copy(source$,dest$)
- LOCAL block%
- OPEN "I",#90,source$
- OPEN "O",#91,dest$
- block%=LOF(#90)
- WHILE block%>32000
- PRINT #91,INPUT$(32000,#90);
- SUB block%,32000
- WEND
- PRINT #91,INPUT$(block%,#90);
- CLOSE #90
- CLOSE #91
- RETURN
-
- Donotcopyafile"toitself"onaharddisk.Thankstoyetanotherbugin
- TOS,thisactioncouldcompletelywipeouttheharddisk.Orperhapsthis
- shouldbecalledafeatureofTOS,puttheretopunishthecrazyuserwho
- triestocopyafiletoitself.
- ü
-
- DiskFormatÇ
-
- Adiskcontains80concentrictracks(numbered0-79)ormore.Sometimes
- theexpression"cylinder"isusedinsteadof"track".Eachtrackis
- dividedinto9,10oreven11sectors.Onesectorcancontain512data-
- bytes.InordertobecompatiblewithMS-DOS,TOSformatsadiskwith80
- tracksand9sectors/track.Actuallyit'seasytofit10sectorsinone
- track.Withalittlemoreeffortyoucancreateroomfor11sectors,but
- somedrivesrunslightlytoofastandarenotabletoreadthe11th
- sector!
-
- Withadisk-editoryoucanexaminethe512data-bytesofasector,but
- youcan'texaminethesector-layoutwithoutaccessingtheFloppyDisk
- Controller(FDC)directly.Inthatcaseyouwouldfindthefollowing
- layoutforeachsector:
- data-separator(GAP) -15bytes
- ID-Addressmark -1byte
- sector-header -4bytes(track,side,sector,size)
- CRCofsectorheader -2bytes
- dataseparator -37bytes
- Data-AddressMark -1byte
- databytes -512bytes
- CRCofdatabytes -2bytes
- dataseparator -40bytes
- ThedataseparatorbytesaretheretosynchronizetheFDCproperly.The
- FDCrecognizesthesector-headerbytheprecedingID-Addressmark.The
- sector-headeritselfcontainsinformationaboutthecurrenttrack,side
- andsectorandalsoaboutthesizeofthedata-field(usually512bytes).
- TheFDCchecksboththesector-headerandthedata-fieldforcorrupted
- bytesbycomparingacomputed"checksum"withthestoredCRC-value.The
- operatingsystemcannotread/writeonebytefrom/toasector,only
- Çcompletesectorsarereadorwritten.GFA-Basictakescareofallthe
- dirtywork.
-
- Firstsomebadnews.ACRC-errorisnotalwaysrecognizedbytheROMof
- 520ST'sand1040ST's(buginXBIOS8,Floprd).Ifyourpalmsarenow
- gettingsweatty,youcouldcheckyourmostpreciousdiskswithXBIOS19
- (Flopver).Thisfunctionchecksfor'lostdata,RNF-orCRC-errors'.
- Createabufferof1024bytesandcallXBIOS19.Asector(512bytes)is
- loadedfromthediskindriveAorB(0or1)intothesecondpartofthe
- bufferandchecked.Ifabadsectorisfound,thesector-numberisstored
- asawordinthefirstpartofthebuffer.Aftercheckingallsectorsin
- onetrackyouhavetoexaminetheword-listinthebuffer.Hopeyouwill
- findonly&H0000there.Ileavethewritingofthisprogramasanexercise
- tothereader.NeverthoughtIwouldusethatphrasemyself.Allright,
- here'ssomethingtogetstarted:
- buffer$=STRING$(1024,0)
- adr%=V:buffer$
- r%=XBIOS(19,L:adr%,L:0,drive,1,track,side,9) !if9sectors/track
- Youshouldnowbeabletofindoutifthetrackonthisside(0or1)is
- OK.Goodluck.
-
- YoucanuseBIOS7(Getbpb)toexaminethedisk-formatintheso-called
- BIOS-Parameter-Block(BPB)ofthedisk:
- bpb.adr%=BIOS(7,drive) !addressofBPB,or0(=error)
- In9wordsyou'llfindthefollowinginformationintheBPB:
- êoffsetÇ
- 0 -bytes/sector(usually512)
- 2 -sectors/cluster(usually2)
- 4 -bytes/cluster
- 6 -numberofdirectory-sectors
- 8 -lengthofFAT
- 10 -firstsectorofsecondFAT
- 12 -firstdata-sector
- 14 -totalclusters
- 16 -flag(notused)
-
- UseGEMDOS54(Dfree)tofindouthowmanyfreeclustersareavailable,or
- simplyuseDFREEifyouwanttoknowhowmanyfreebytesareavailableon
- adrive.Duetoabug,GEMDOSmissesthelasttwoclustersonadisk.You
- can'twritetotheseclusters(2048bytesdownthedrain...),butyoucan
- readtheseclustersiftheydocontaindata.Thatwouldbeamiracle,or
- anMS-DOSdisk.
-
- You'llprobablyuseXBIOS10(Flopfmt)toformatadiskfromGFA-Basic.If
- youdo,use&H0000asthevirgin-valueforthefirst18sectors,andthen
- &HE5E5foralldata-sectors.Youcanuseeither9or10sectors/track,not
- 11.Ifyouuse10sectors/track,youshouldfillthefirsttwotrackswith
- &H0000andfillsectors19and20with&HE5E5afterwards(readthe
- paragraph'Sectors').Idon'trecommendmorethan80tracks,certainlynot
- morethan82tracks.IfXBIOS10returnsavalueotherthan0,you'llfind
- alistofbadsectorsinthebufferyouused(terminatedwith&H00).If
- oneofthefirst18sectorsisbad,youcanthrowthediskaway.
-
- ÇUsingXBIOS10,theinterleave-factorshouldbe1.Thismeansthesectors
- onatrackarenumberedconsecutively:1,2,3,4,etc.Idon'tunderstand
- whysomeprogrammersuseanothervalueandcallit'FastFormat'.TheFDC
- needsmoretimetoreadacompletetrackiftheinterleave-factorisnot
- 1.Perhapstheytrytocreatetheso-calledTwisted(orSkewed)format.
- TOSlosestimeiftheheadmovestothenexttrack.BecausetheSeekwith
- Verifyflagisset,theFDCfirstverifiesthetrack-numberandthenreads
- thesector-number.Whilecheckingthetrack-number,sector1waspassing,
- sowehavetowaitforonecompletespinofthedisk(200ms,yawn)until
- sector1canberead.OnesolutionistocleartheSeekwithVerifyflag,
- butthatcouldleadtonastyproblemsiftheheadstillrattlesslightly
- atthetimesector1isread.ThebestsolutionistheTwistedformat
- (adoptedbyAtarifromtheMegaSTonwards).Forasingle-sideddiskwith
- 9sectorsononetrackthismeans:
- track0:sector1,2,3,4,5,6,7,8,9
- track1:sector8,9,1,2,3,4,5,6,7
- track2:sector6,7,8,9,1,2,3,4,5
- etc.
- Now,sector1isencounteredalmostimmediatelyafterthetrack-numberis
- verified.A1-sectoroffsetisnotpossible,buta2-sectoroffsetis
- enoughtosettletherattlinghead.Itisimpossibletoreaddatafaster
- fromadisk!ButI'mafraidyoucan'tformataTwisteddiskwithXBIOS10
- ifyouhaveanoldTOS.Youhavetouseaspecialformat-program.
-
- Ifyouformatadiskfromthedesktop,badclustersareflaggedwitha
- specialvalueintheFAT.However,ifTOS1.4encountersabadsector,
- somethinggoeswrongandtheFATiscorrupted.Onemorereasontoquit
- smoking,becausesmoke-particlesdefinitelyconstituteaserioushazardto
- thehealthofyourdisks.
-
- YoucanuseXBIOS18(Protobt)tocreateabootsectorontheformatted
- disk.Don'tworryaboutthemedia-byte(disk-type),becauseTOSdoesn't
- useit.Douse&H1000000togeneratearandomserialnumber,becauseitis
- êveryÇimportantthatdifferentdiskshavedifferentserialnumbers!Write
- thebootsectortothediskwithXBIOS9(Flopwr),notwithBIOS4(Rwabs):
- r%=XBIOS(9,L:buffer%,L:0,drive%,1,0,0,1)
-
- Whyaredifferentserialnumberssoimportant?IfTOSsuspectsadisk-
- swap,theserialnumberisreadfromthedisk.Adisk-swapcanonlybe
- recognizedifthenumberonthenewdiskisdifferentfromtheoldnumber.
- Ifthenewdiskcontainsthesameserialnumber,TOSusestheFATofthe
- previousdisk.Writingtoaswappeddiskwillprobablyzapit,ifyou
- followme.Disk-copierscopyeverything,includingserialnumbers.Be
- careful!
-
- AlthoughitispossibletoformatadiskfromGFA-Basic,Idon'trecommend
- it(nowhetellsus...).Myfavouriteformatis:
- 80tracks
- 10sectors/track
- Twistedformat
- IuseTWISTER.PRG(notPublicDomain,asfarasIknow),butyoucoulduse
- aPublicDomainprogramlikeDCOPY(actuallyShareware).TheDesktopcan't
- copyaTwisteddisk,butfile-copyisalwayspossible.DCOPYcopiesany
- format,includingTwistedformat.
- üFileAllocationTable(FAT)
- Ç
- Thefirstsectoronadiskistheboot-sector.Thenextfivesectorsare
- reservedfortheFAT.AndthenextfiveforacopyoftheFAT(actually
- it'stheotherwayaround).Finally,themain(orroot)directoryoccupies
- thenext7sectors(32bytesforeachslot).Thismeansthatthefirst18
- sectors(No.0-17)arereservedfortheoperatingsystem.Allother
- sectorsareavailableforstoringfiles.
-
- Thestorage-unitforfilesisacluster.Aclusterconsistsoftwo
- consecutivesectors(1024bytes).Afilethatcontainsonly1bytewill
- thereforestilloccupy1024bytes(1K)onthedisk.Whenafileissaved,
- theoperatingsystemlooksforthefirstemptycluster,thenthenext,
- etc.InformationaboutavailableclustersisstoredintheFATasa
- collectionofpointers.Duetoinefficientprogramming,thesearchfor
- freeclusterstakesalongtime.TryDFREEonaharddiskandyou'llagree.
- InstallaprogramlikeFATSPEED.PRG(PublicDomain,byUlrichKuebler)to
- speedthisup!
-
- ThefirstthreebytesoftheFATarenotusedbyTOS,butarethereto
- enableMS-DOStoreadanST-formatteddisk.TOSwrites&HF7FFFF,wherethe
- firstbyte(&HF7)issupposedtobethemedia-byte.UnfortunatelyMS-DOS
- doesn'tunderstandthisandrefusestoreadthedirectoryproperly.I'm
- notquitesurewhy,butchangingthefirstthreebytesto&H000000seems
- towork.Youcouldtry&HF8FFFF(80tracks,9sectors/track,singlesided
- disk)or&HF9FFFF(doublesideddisk)instead.Oryoucouldusethemedia-
- byteatoffset21fromthebootsector.TomakeyourMS-DOSfriends
- completelyhappy,youshouldchangethefirstthreebytesofthebootsec⑨
- torto:&HEB3890.Sometimes(DOS4.0?)youhavetochangethenextthree
- bytesaswell:&H49424D(that'sIBMinASCII;pleasewatchyourlanguage).
- Betterstill,letthemusetheirowndiskeditorontheirMS-DOScomputer
- (e.g.NortonUtilities).Whyshouldyoudoallthework?Bytheway,your
- STshouldbeabletouseanMS-DOSdiskwithoutanymodifications.
-
- EachFAT-pointerconsistsofoneandahalvebyte(3nibbles,i.e.12
- bits).Inhexadecimalnotationthismeansthreedigitsforonepointer.
- Thefirstpointer(No.0)pointstoclusterNo.0,thesecondtoNo.1,
- etc..Becausethefirsttwopointersdon'tcount,youhavetosubtract
- twotofindtheactualcluster(pointer2pointstoclusterNo.0,etc.).
- ThefirstclusterstartsatsectorNo.18(remember,sectors0-17are
- reservedforbookkeeping),soyoucouldfindthefirstsectorofacluster
- with:
- (pointer-2)*2+18
- Thesecondsectorofthisclusterisofcoursethenextone.
-
- ÇTOSreadsthepointersinapeculiar(MS-DOS)way.SupposetheFAT-sector
- startswith:
- F7FFFF034000FF0F00
- Withoutfurtherexplanation,thistranslatesto:
- FAT-pointer0and1areignored
- FAT-pointer2=&H003(nextclusteronsector20+21)
- FAT-pointer3=&H004(nextclusteronsector22+23)
- FAT-pointer4=&HFFF(lastclusterofthisfile)
- FAT-pointer5=&H000(freecluster)
- Inordertounderstandthis,youhavetoconsultthefollowingtable:
- &H000 :clusterstillavailable
- &HFF1-&HFF7:badcluster,neveravailable
- &HFF8-&HFFF:lastclusterofthisfile(EndOfFile)
- &H002-&HFF0:pointertonextcluster
- AssumingtheFAT-pointer&H002atoffset26inthedirectory(you'llfind
- &H0200withadiskeditor,that'sIntelformatwithêlowÇbytefirstagain),
- youshouldbeabletofigureoutthatthisfilewillbefoundinsectors
- 18through23.Sectors24/25areempty,sothisclusterisavailablefora
- newfile.Anyquestions?Theonebigadvantageofallthisiscompatibi⑨
- litywithMS-DOSdisks.WithTOS1.4yourST-diskscanbemadecompletely
- compatible,soyoudon'tevenhavetochangeafewbytes.
-
- Right,youhavejustreadtheFatman-book.Themoviewillbereleased
- shortly,butyoucanNOWbuythosefabulousFatman-shirtsandfantastic
- Fatman-buttons.CallAtariforfurtherdetails.
-
-
- üSectorsÇ
-
- Therearetwodifferentmethodstoassignanumbertoasector.Thefirst
- oneistonumberthe"physical"sectorsineachtrackfrom1to9
- (assuming9sectors/track).Thiswayyoucouldsaythebootsectoris
- sector1ontrack0(onside0ifthediskisdoublesided).ButGEMDOS
- doesn'tcareabouttracksorsides,itcounts"logical"sectorsfrom0to
- 719(80tracks,9sectors/track,onesideddisk)orfrom0to1439(double
- sideddisk).AccordingtoGEMDOS,thebootsectorisonsector0.Andona
- doublesideddisk,physicalsector1ontrack0ofside1(theotherside)
- wouldbesector9.
-
- WithBIOS4(Rwabs)youcanread(andwrite)completeêlogicalÇsectors:
- buffer$=SPACE$(512) !512bytesfor1sector
- buffer%=V:buffer$ !addressofbuffer
- r%=BIOS(4,0,L:buffer%,1,sector%,drive%) !loadthesucker
- YouwouldloadthebootsectorfromthediskindriveAwith:
- r%=BIOS(4,0,L:buffer%,1,0,0)
- YoucanuseBIOS4notonlywithfloppydisks,butalsowithaharddisk
- oraRAM-disk.Afterloadingasector,youcanreadonebytewith:
- b|=BYTE{buffer%+n} !nfrom0to511
- Youcanreadawordwith:
- w=WORD{buffer%+n}
- ButonlyifthewordstartsatanêevenÇaddress.Otherwiseyouhavetouse:
- w=BYTE{buffer%+n+1}+256*BYTE{buffer%+n}
- ÇIfnecessary,youcanspeedthisupbyusingthespecialintegercommands
- foradditionandmultiplication.HowaboutthisPolishmonster:
- DEFFN word(adr%)=ADD(BYTE{SUCC(adr%)},MUL(256,BYTE{adr%}))
- Thenyouwoulduse:
- w=@word(ADD(buffer%,n))
-
- IfyouuseBIOS4towriteasectorafterformattingadisk,youshould
- use'3'asaflag(not'1'):
- r%=BIOS(4,3,L:buffer%,1,sector%,drive%)
-
- YoucanalsoreadandwriteêphysicalÇsectorswithXBIOS8(Floprd)and
- XBIOS9(Flopwr).Withthesecommandsyoucouldevenread/writeall
- sectorsononetrack.Thisistheonlywaytoreadatrack,because
- readingacompletetrackisimpossibleduetoabugintheFDC.
-
- Ifyouswapadiskafterloading/writingasectoryoushouldbecareful.
- TestingwithBIOS9(Mediach)youcouldêmissÇthedisk-swap.Thiscouldbe
- fatal,becauseTOSusestheFAToftheotherdisk!Ithinkyoucoulduse
- BIOS7(Getbpb)inmostcases,butusetheProcedureForce.mediachifin
- doubt:
- PROCEDUREforce.mediach
- LOCALx$,old.vector%,a%
- x$=SPACE$(12)
- old.vector%=LPEEK(&H47E)
- a%=V:x$
- DPOKEa%,&H2B7C
- LPOKEa%+2,old.vector%
- DPOKEa%+6,&H47E
- DPOKEa%+8,&H7002
- DPOKEa%+10,&H4E75
- SLPOKE&H47E,a%
- ~DFREE(0) !currentdrive
- RETURN
- Tobemoreprecise,BIOS7can'tbeusedinthefollowingsituation:
- -TOSreadsasector
- -youswapdisks
- -youuseBIOS7inyourprogram
- -TOSreadsasector
- NowTOSwillassumetherehasbeennodisk-swap,becausetherehasbeenno
- disk-swapafterthelastBIOS7call!YoudefinitelyneedtheProcedure
- Force.mediachinthiscase.
-
- Bythetrack,TOSalsoignoresdisk-swapsduringascreendump(HARDCOPY),
- orwhileusingDMA(harddisk,laserprinter).TOSdetectsadisk-swapby
- monitoringthewrite-protectstate.Toseethis,youshouldturnall
- lightsoffandthenwatchthedrive-lightclosely.Closer.Youcanturn
- thelightsonagain.Ifthedriveisempty,TOSgetsawrite-protect
- signalandassumestheusermighthaveswappeddisks.BIOS9shouldreturn
- '1'atthispoint.TOSchecksifyoureallydidswapdisksbyreadingthe
- serialnumberfromthebootsectorandcomparingitwiththecurrent
- number.Onlyifthesenumbersaredifferent,adisk-swapisrecognizedby
- TOS(BIOS9shouldreturn'2'now).YouprobablydeducedthatTOSwill
- readthebootsectoralsoifyouuseawrite-protecteddisk.Continuously
- readingthebootsectorisawasteoftime,soTOSwaits1.5secondsbefore
- Çlookingagain.Neverswapdiskswithin1.5secondsafteraread/write-
- operation.Thedrivekeepsspinningfor2seconds,soyoucan'tgowrong
- ifyouwaituntilthedrive-lightisoffbeforeswappingdisks.
-
- üBootsectorÇ
-
- Inthefollowingtableyou'llfindthelay-outofabootsector.Allwords
- areinIntel-format,exceptCHKSUM.
-
- êoffsetÇ êlengthÇ ênameÇ
-
- 0 2 &H6038=branchtobootroutine
- 2 6 FILLER fill-bytes
- 8 3 SERIAL serial-numberofdisk
-
- 11 2 BPS bytes/sector(512)
- 13 1 SPC sectors/cluster(2)
- 14 2 RES reservedsectors(1,Bootsector)
- 16 1 NFATS numberofFAT's(2)
- 17 2 NDIRS max.entriesinmaindirectory
- 19 2 NSECTS totalsectors
- 21 1 MEDIA media-byte(notusedbyTOS)
- 22 2 SPF sectors/FAT(5)
- 24 2 SPT sectors/track
- 26 2 NSIDES sides(1or2;nojokethistime)
- 28 2 NHID hiddensectors(ignoredbyTOS)
-
- 30 2 EXECFLAG startofbootcode:flag
- 32 2 LDMODE 0=loadFNAME;<>0=loadsectors
- 34 2 SSECT firstsector(LDMODE<>0)
- 36 2 SECTCNT numberofsectors
- 38 4 LDADDR loadatthisRAM-address
- 42 4 FATBUF addressofFAT-buffer
- 46 11 FNAME filename(nnnnnnnneee)(LDMODE=0)
- 57 1 DUMMY fill-byte
-
- 58 boot-routine(couldbeaboot-virus)
-
- 510 2 CHKSUM
-
- TOSdeterminesifthebootsectorisexecutablebyaddingallbytes.If
- thissum(AND&HFFFF)equals&H1234,thebootsectorisexecutable.Ifyou
- useGFA-BasicthisprobablymeansyouhaveanancientSTwithTOSinRAM,
- oraboot-virus.AnormalGFA-diskhasonly&H00-or&HE5-bytesfromthe
- offset58.
-
-
- üBLOADÇ
-
- BLOADneedsanaddress,unlessyouhaveusedBSAVEinthesameprogram
- before.InthatcasetheBSAVE-addressisusedautomaticallybyBLOADif
- youdon'tspecifyanewaddress.
-
- ÇBLOAD(BSAVE)iseasiertousethanBGET(BPUT),becauseyoudon'thaveto
- openthefile.ButwithBLOADyoucanonlyloadtheentirefile,while
- BGETallowsyoutoloadanypartofthefile.
-
-
- üINPandOUTÇ
-
- BothINPandOUTcanalsobeusedwith2-byteand4-byteintegers:
- a|=INP(#n)
- a&=INP&(#n)
- a%=INP%(#n)
- OUT#n,a|
- OUT&#n,a&
- OUT%#n,a%
-
-
- üINPUTandLINEINPUTÇ
-
- BecauseGFAnowusesa4K-bufferforeachopenedfile(version3.07),
- readingdatafromafilewith(LINE)INPUTgoesmuchfaster.
-
-
- üSTOREandRECALLÇ
-
- Forveryfastloadingandsavingofstring-arrays,youshoulduseRECALL
- andSTORE.Youcanalsostore(orrecall)apartofanarrayasfollows:
- STORE#1,txt$(),10 !storeelements0through9
- STORE#1,txt$(),5TO10 !storeelements5through10
-
- Thecorrectsyntaxis:
- STORE#i,x$()[,n[TOm]]
- RECALL#i,x$(),n[TOm],x% (usen=-1forcompletearray)
- Ofcourseyouhavetoopenthefilefirst.
-
- IfyouSTOREatext-array,GFAputs&H0D0A(CHR$(13);CHR$(10))aftereach
- element.Thisisthesameformatasusedby1stWordPlus(WPModeoff,
- i.e.ASCII-mode),Tempus,etc.
-
- Ifyou'regoingtoshowmorethanafewtext-lines,youcouldenterthe
- textasDATA-lines,e.g.withtheProceduresInitio.text.arrayand
- Initio.text.array.low(forLowresolution):
- PROCEDURE initio.text.array
- ' *** global : TEXT$()
- LOCAL lines,line$,n
- lines=0
- RESTORE txt.data
- READ line$
- REPEAT
- INC lines
- READ line$
- UNTIL line$="***"
- Ç ERASE text$()
- DIM text$(lines)
- RESTORE txt.data
- FOR n=1 TO lines
- READ text$
- text$(n)=SPACE$(5)+text$ ! left margin of 5 spaces !!
- NEXT n
- txt.data:
- DATAtext
- DATA ***
- RETURN
-
- Ifyouaregoingtoshowmoretext,Isuggestyouuse1stWordPlus,or
- anyotherwordprocessorortext-editorthatcansaveyourtextasan
- ASCII-file.With1stWordPlus,IuseaRulerlengthof70andthe
- followingPageLayoutForm:
- Paperlength 66
- TOFmargin 19
- Headmargin 4
- Footmargin 4
- BOFmargin 19
- Lines/page 20
- EnterthetextandsaveasanASCII-file(turnWPModeoffbeforesaving).
- InyourGFA-Basicprogramyouwouldfirstloadthetextinastring-array:
- DIMtext$(lines)
- OPEN"I",#1,file$
- RECALL#1,text$(),-1,lines%!lines%≤lines+1
- CLOSE#1
- ThenyoucouldusetheProcedureShow.text.page(HighorMediumresolu⑨
- tion)toshowthetextwith20lines/screen.TheProcedureusesaleftand
- rightmarginof5characters,sothat'swhyyouhavetouse70charac⑨
- ters/lineinyourwordprocessor.Ifthetext-arrayisfull,youwon'tget
- anerrorifthefilecontainsmoretext-lines!
-
- Youcouldusea2-dimensionalstring-arraytostorefirstandlastnames:
- name$(i,0)=first_name$
- name$(i,1)=last_name$
- Again,STOREandRECALLareveryfast.Butitisnownecessarytouse
- exactlythesamedimensionswithRECALLthatyouusedwithSTORE.Ifthe
- dimensionsdon'tmatch,thearraywillbescrambledafterRECALL.
-
-
- üFILESELECTÇ
-
- Don'tusetheunderscore'_'inthepath-lineoftheFileselector,because
- abugintheoldTOSwillthencauseafewbombs.OwnersofaMegaSTor
- TOS-version1.4canuseasmanyunderscoresastheylike.
-
- ChangingdrivesintheFileselector(oldTOS)isnoteasy.Clickonthe
- path-lineandpress<Esc>tocleartheline.Enterthedrive,e.g.'D:\',
- andclickêonÇthebarunderthepath-lineinordertoreadthenew
- directory.Alsoclickonthisbarafterchangingdisks(inthiscaseyou
- wouldpress<Esc>onthedesktop).SelectingdriveAiseasier:justclear
- thepath-lineandclickonthebar.TheTOS-codethattakescareofall
- Çthisworkisalsoknownasthebartender.
-
- Ifyouhavechangedtheextensioninthepath-line,youshouldclickêjust
- belowÇthebar.IfyouclickêonÇthebar,thepath-lineisoverwrittenwith
- '*.*'!Thatsamebartenderstrikesagain.
-
- ThecorrectsyntaxforcallingtheFileselectoris:
- FILESELECT[#title$,]path$,default$,file$
- ThetitleisonlyusedinTOS-version1.4andignoredinolderTOS-
- versions.Thedefault$usuallyisthenull-string(""),butdon'tusethe
- null-stringforpath$ortheFileselectorwillfreeze.Use"\*.*"aspath$
- forallfilesinthemaindirectory.Dousethebackslashinthepathname
- (e.g."A:\*.*").DuetoabuginGEM,thewrongdriveissometimesusedif
- youforgetthebackslash("A:*.*").Iftheuserhasselectedafile,file$
- willcontainthepathandfilename.Thefile$willbethenull-stringif
- theuserselected<Cancel>.Athirdpossibilityiseasilyoverlooked:the
- usercouldhaveselected<OK>withoutchoosingafile.Inthatcasefile$
- containsthecurrentpath,endingwithabackslash.
-
- Donotdespairifyouneedatitle,butdon'thaveTOS1.4.Trythe
- ProcedureFileselect(HighorMediumresolution)orFileselect.low:
- PROCEDURE fileselect(path$,default$,txt$,left$,right$,VAR file$)
- ' *** print optional title (light text) to left and right
- LOCAL screen$,y.fac
- SGET screen$
- CLS
- IF high.res!
- y.fac=1
- ELSE
- y.fac=2
- ENDIF
- DEFTEXT black,2,900,32
- TEXT 100,350/y.fac,300/y.fac,left$
- DEFTEXT ,,2700
- TEXT 540,50/y.fac,300/y.fac,right$
- DEFTEXT ,0,0,13
- PRINT AT(1,3);@center$(txt$)
- GRAPHMODE 3
- DEFFILL black,1
- BOUNDARY 0
- IF high.res!
- BOX 157,25,482,54
- PLOT 157,25
- PBOX 159,27,480,52
- ELSE
- BOX 157,12,482,27
- PLOT 157,12
- PBOX 160,14,479,24
- ENDIF
- BOUNDARY 1
- GRAPHMODE 1
- FILESELECT path$,default$,file$
- SPUT screen$
- RETURN
- ÇAsaprogrammer,youshouldtakeintoaccountthepossibilitythatauser
- mightstartyourprogramfromdriveA,aharddiskoraRAM-disk.Iusethe
- StandardGlobaldefault.path$torememberwheretheprogramwasstarted.
- Iftheuserchangesthe(default)pathintheFileselector,youshould
- notethechangeandusethenewpathiftheFileselectoriscalledagain.
- UsetheProcedureParse.filenameforthispurpose:
- PROCEDURE parse.filename(parse.name$,VAR drive$,path$,file$,ext$)
- LOCAL pos,first,last,last!,search,parse.file$
- '
- parse.name$=UPPER$(parse.name$)
- IF MID$(parse.name$,2,1)=":"
- drive$=LEFT$(parse.name$,1)
- ELSE
- drive$=CHR$(65+GEMDOS(&H19)) ! current drive
- ENDIF
- '
- pos=1
- last!=FALSE
- last=0
- first=INSTR(1,parse.name$,"\")
- REPEAT
- search=INSTR(pos,parse.name$,"\")
- IF search>0
- pos=search+1
- last=search
- ELSE
- last!=TRUE
- ENDIF
- UNTIL last!
- IF last>0 ! backslash discovered
- path$=MID$(parse.name$,first,last-first+1)
- parse.file$=MID$(parse.name$,last+1)
- ELSE ! no '\'
- path$=""
- pos=INSTR(1,parse.name$,":")
- IF pos>0
- parse.file$=MID$(parse.name$,pos+1)
- ELSE
- parse.file$=parse.name$
- ENDIF
- ENDIF
- pos=INSTR(parse.file$,".")
- IF pos>0 ! name with extension
- ext$=MID$(parse.file$,pos+1)
- file$=LEFT$(parse.file$,pos-1)
- ELSE ! name without extension
- ext$=""
- file$=parse.file$
- ENDIF
- RETURN
-
- IfyouhaveajoystickwithAuto-Fireon,youshouldswitchitoff.The
- Fileselectordoesn'tlikeAuto-Fire.NeitherdoI.
-
- ÇTheFileselectorwillwarnyouwithamodest'ping'ifitcountsmorethan
- 100files/folders.Itwillshowonlytheêfirst100Çfiles/folders.Ithink
- 45filesinonefolderisreallythelimitforimpatientuserslike
- myself.Morethan100isacrimethatshouldbepunishedwithmorethana
- 'ping'.ThemaindirectoryofdriveAcan'tcontainmorethan112
- files/folders,becausethe7directory-sectorscontain11232-byteslots.
-
- Everytimeyouopenafolder(intheFileselector,orotherwise),TOS
- storesinformationaboutthefolderinatable.Afteropening/accessing40
- folders,TOSwilldeleteclusters,cross-linkclusters,anddoothernasty
- things.Yourdiskcouldbecompletelydestroyed,thankstothisbug.Atari
- enlargedthebufferinTOS1.2andfixedthebuginTOS1.4.Atarialso
- distributestheprogramFOLDRxxx.PRGtoextendthe40-folderlimitwith
- 100(FOLDR100.PRG)ormore.BecarefulwithSHOWINFO,it'seasytoexceed
- the40-folderlimit!Youcouldrecognizeadisasterbyoneofthe
- followingsymptoms:
- -unexpected'0bytesin0items'messageindirectory
- -folder-namestrashed(usuallylotsofGreekletters)
- -ShowInfocrashesorshowsweirdinformation
- Don'tbeafraidofanewvirus.It'sonlyaTOS-bug.Immediatelyreset
- yourST,trytosalvageasmanyfilesaspossibleandreformatthedisk.
- Ifallfilesarelost,youwillhavetouseyourback-upfiles.Ifyou
- don'thaveback-upfiles,youhavenothingleftbutmysympathy.
-
-
- üë12.MIDI
- Ç
-
- üINPMID$Ç
-
- WiththecommandINPMID$theinternalMidi-bufferisreadandatthesame
- timecleared.YoucanfindthebufferwithXBIOS14(Iorec):
- adr%=LPEEK(XBIOS(14,2))
- Thedefaultsizeofthisbufferisonly128bytes,butyoucanusethe
- ProcedureChange.midi.buffertochangethesizeofthebuffer:
- PROCEDURE change.midi.buffer(size%)
- LOCAL ptr%
- ptr%=XBIOS(14,2)
- ERASE buffer|()
- DIM buffer|(size%-1)
- LPOKE ptr%,VARPTR(buffer|(0)) ! start-address ofnew buffer
- DPOKE ptr%+4,size% ! size
- DPOKE ptr%+6,0 ! buffer-head
- DPOKE ptr%+8,0 ! buffer-tail
- DPOKE ptr%+10,0 ! low mark (not used)
- DPOKE ptr%+12,size%-1 ! high mark (not used)
- RETURN
- BecausehandshakeisimpossiblewithMidi,youneedalargebufferif
- Midi-bytesarecominginfast.
-
-
- üINPÇ
-
- IfyouuseINP(3)toreadMidi-bytes,youshouldfirstcheckwithINP?(3)
- iftheMidi-buffercontainsdata.IfyouuseINP(3)andnobytesare
- available,yourSTwillfreeze.Untilyouresetthecomputer.
-
-
- üMidi-commandsÇ
-
- StudytheProceduresinthefileMIDI.LSTtoseehowyoucanuseMidi-
- commandsinGFA-Basic.WiththeProceduresRecord.midiandPlay.midiyou
- couldwriteasimpleMidi-recorder.AndtheProcedureMidi.monitorcanbe
- usedtoexamineincomingMidi-messages.
- PROCEDURE record.midi(VAR midi.byte|(),midi.time%())
- ' *** uses Procedure All.midi.off
- ' *** global : LAST.MIDI.BYTE%
- LOCAL last%,buffer$,i%,t%,time%,byte|,delay%,j%,m$,k
- ARRAYFILL midi.byte|(),0
- ARRAYFILL midi.time%(),0
- last%=DIM?(midi.byte|())-1
- m$=STR$(last%)+" bytes available ;| |stop recording|"
- m$=m$+"by pressing space"
- ALERT 3,m$,1,"RECORD",k
- REPEAT
- UNTIL INKEY$=""
- buffer$=INPMID$ ! clear MIDI-buffer
- i%=1
- t%=TIMER
- Ç REPEAT
- IF INP?(3)
- byte|=INP(3)
- IF byte|<>254
- time%=SUB(TIMER,t%)
- midi.byte|(i%)=byte|
- midi.time%(i%)=time%
- INC i%
- ENDIF
- ENDIF
- UNTIL i%=last% OR INKEY$=" "
- last.midi.byte%=i%-1
- @all.midi.off
- delay%=midi.time%(1) ! subtract time for first note
- FOR j%=1 TO i%
- SUB midi.time%(j%),delay%
- NEXT j%
- m$="|"+STR$(i%)+" bytes recorded"
- ALERT 3,m$,1," OK ",k
- RETURN
- '
- PROCEDURE play.midi(VAR midi.byte|(),midi.time%())
- ' *** uses Procedure All.midi.off
- LOCAL m$,k,i%,t%,time%
- m$="record of "+STR$(INT(midi.time%(last.midi.byte%)/200))+
- m$=m$+" seconds| |(stop by pressing space)"
- ALERT 3,m$,1,"PLAY",k
- REPEAT
- UNTIL INKEY$=""
- i%=1
- t%=TIMER
- REPEAT
- time%=SUB(TIMER,t%)
- IF midi.time%(i%)<=time%
- OUT 3,midi.byte|(i%)
- INC i%
- ENDIF
- UNTIL i%=last.midi.byte% OR INKEY$=" "
- @all.midi.off
- RETURN
- '
- PROCEDURE midi.monitor
- LOCAL m$,k,byte|,byte$,hex$,bin$,buffer$,key$
- byte$=SPACE$(3)
- hex$=SPACE$(2)
- bin$=SPACE$(8)
- m$="all incoming bytes|(except 254) are|printed on screen ;|"
- m$=m$+"stop by pressing space"
- ALERT 1,m$,1,"START",k
- m$="press|<Return>|for CLS"
- ALERT 1,m$,1," OK ",k
- REPEAT
- UNTIL INKEY$=""
- Ç buffer$=INPMID$ ! clear MIDI-buffer
- CLS
- PRINT TAB(10);"dec";TAB(20);"hex";TAB(30);"binary"
- REPEAT
- REPEAT
- key$=INKEY$
- IF INP?(3)
- byte|=INP(3)
- IF byte|<>254
- IF TIMER-t%>200
- PRINT
- ENDIF
- t%=TIMER
- RSET byte$=STR$(byte|)
- RSET hex$=HEX$(byte|)
- RSET bin$=BIN$(byte|)
- PRINT TAB(10);byte$;TAB(20);hex$;TAB(30);bin$
- ENDIF
- ENDIF
- UNTIL key$=" " OR key$=CHR$(13)
- IF key$=CHR$(13)
- CLS
- ENDIF
- UNTIL key$=" "
- @all.midi.off
- REPEAT
- UNTIL INKEY$=""
- PRINT " (press any key)"
- ~INP(2)
- RETURN
-
-
- üë13.MODEM
- Ç
-
- üINPAUX$
-
- ÇWiththecommandINPAUX$theinternalRS232-bufferisreadandatthesame
- timecleared.Youcanfindtheaddressoftheinput-bufferwith:
- adr.in%=LPEEK(XBIOS(14,0))
- Theoutput-buffercanbelocatedwith:
- adr.out%=LPEEK(XBIOS(14,0)+14)
-
-
- üINPÇ
-
- IfyouuseINP(1)toreadincomingbytes,youshouldalwayscheckwith
- INP?(1)iftheRS232-buffercontainsdata.
-
-
- üRsconf(XBIOS15)Ç
-
- WithXBIOS15(Rsconf)youcanchangetheRS232-parameters.Afew
- baudrates:
- 0-19200baud
- 1-9600baud
- 4-2400baud
- 7-1200baud
- 9-300baud
- 14-75baud
- Use-1forparametersyoudon'twanttochange.DuetoaTOS-bug,you
- can'tuse75baud,because'14'resultsin120baud.Also,theoldTOS
- (pre-Blitterage)can'thandlehardwarehandshakewithRTS/CTS-signals.
- Atarihasreleasedabug-fixthatshouldenableanyTOStouseRTS/CTS.
- Softwarehandshaking(XON/XOFF)functionsproperly.Thedefault
- afterpower-up isnohandshakeprotocol.
-
-
- üë14.MOUSE
- Ç
-
- üEditorÇ
-
- Sometimestheeditorseemstofreezewhilethecursorisblinkingrapidly.
- Justmovethemouseandtheeditorcomesaliveagain.
-
-
- üFileselector
-
- ÇSometimesthesameblinkingmouseappearsaftercallingtheFileselector
- oranAlert-box.I'vereadsomewherethiscouldbeduetothecombination
- ofaVDI-function(forthemouse)andanAES-function(forFileselectoror
- Alert-box).GFAtakescareofthefirstandGEMofthesecond,and
- sometimesthisseemstoresultinaconflict.
-
-
- üMOUSEÇ
-
- IfyourepeatedlycallaProcedureinwhichyoutestforamouse-click,
- youshouldincorporateashortpauseintheProcedure(e.g.PAUSE5).
- OtherwisetheProceduremightbecalledagainwhiletheuserisstill
- holdingthebuttondown.Youcouldalsowaituntiltheuserreleasesthe
- button:
- REPEAT
- UNTILMOUSEK=0 !waituntilbuttonisreleased
-
- Ifyoufinditdifficulttomovethemouseaccurately,youcoulduse
- <Shift><Alternate><arrow>tomovethemouse-cursoronepixelinthe
- desireddirection.Ifyoupress<Insert>aswell,youcan"drag"something
- accuratelyasiftheleftmouse-buttonwaspressed.
-
- Youcanfindthemaximalx-andy-coordinatesofthemousewith:
- x=DPEEK(&H9862)
- y=DPEEK(&H9864)
- Butthere'snoguarantyyouwillfindthecoordinatesthere.Experiment
- withXBIOS0foramorereliablemethod.Don'taskmehow.
-
- MOUSEreturnsnegativecoordinatesifthemouseistotheleftoforabove
- thecurrentwindow(ortheoriginthathasbeenselectedwithCLIP
- OFFSET).
-
-
- üSETMOUSEÇ
-
- Amouseclickcanbesimulatedwith:
- SETMOUSEmx,my,mk
- IfyoutrythiswithanAlert-buttonyouhavetomovethemouseafter-
- wards,orthebuttonwon'tbeselected.Idon'tknowwhy,soIcan'ttell
- ifthisisabug.
-
-
- üDEFMOUSEÇ
-
- YoucanuseoneofthemanyPublicDomainmouse-editorstodesignyourown
- mouse-mutant.Butit'salsoeasytocreateanewmouse-cursorwiththe
- ProcedureInitio.mouse1:
- PROCEDURE initio.mouse1
- ' *** global : MOUSE1$
- RESTORE pattern.mouse1
- @make.mouse(mouse1$)
- pattern.mouse1:
- ' *** x,y,mode(0=normal;1=XOR),mask-colour,mouse-colour
- DATA 0,0,0,0,1
- ' *** mask-pattern (1 = pixel on , 0 = pixel off)
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- ' *** mouse-pattern
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- RETURN
- '
- Ç PROCEDURE make.mouse(VAR m$)
- LOCAL x,y,mode,msk.color,mouse.color,n,msk%,mouse%,msk.pat$
- LOCAL mouse.pat$,msk$,mouse$,pat$
- CLR msk.pat$,mouse.pat$,pat$
- READ x,y,mode,msk.color,mouse.color
- FOR n=1 TO 16
- READ msk$
- msk%=VAL("&X"+msk$)
- msk.pat$=msk.pat$+MKI$(msk%)
- NEXT n
- FOR n=1 TO 16
- READ mouse$
- LET mouse%=VAL("&X"+mouse$)
- LET mouse.pat$=mouse.pat$+MKI$(mouse%)
- NEXT n
- m$=MKI$(x)+MKI$(y)+MKI$(mode)+MKI$(color.index(msk.color))
- m$=m$+MKI$(color.index(mouse.color))+msk.pat$+mouse.pat$
- RETURN
- Themaskshouldbeanexactcopyofthemouse-patternifyouneeda
- transparantmouse.Leavethemaskempty(all'0')andthemousewill
- disappearbehindobjectsonthescreen.Fillthemaskwith'1'andthe
- 16x16mousewillalwaysremainvisible.Switchmask-andmouse-colourin
- thefirstDATA-linetocreatea"reverse"mouse.OruseanyVDIcolour-
- indexthatisavailableinthecurrentresolution.
-
-
- üë15.JOYSTICK
- Ç
-
- üSTRIGandSTICKÇ
-
- HereisanexampleoftheuseofSTRIGandSTICKifyourjoystickis
- connectedtoPort1(yourmouseisconnectedtoPort0):
- STICK1 !joystick-mode(yourmouseisnowdead)
- REPEAT
- IFSTRIG(1)
- joy=3
- ELSE
- joy=STICK(1)
- ENDIF
- ONjoyGOSUBn,s,fire,w,nw,sw,dummy,e,ne,se
- PAUSE5
- (...)
- UNTILcondition!
- STICK0 !backtomouse-mode
- YouneedeightProceduresfortheeightpossibledirections(seebelow)
- andoneProcedurefortheFire-button.Thevalue7('dummy')neveroccurs.
- Ifyoudon'ttouchthejoystick,thevalueof'joy'willbe0,andthis
- meansnoProcedurewillbecalled.Ashortpauseisadvisable,because
- GFA-Basicistoofast.
- 519
- \|/
- directions: 4-0-8
- /|\
- 6210
-
- Ifyoudesperatelyneedanactivemousewhileusingthejoystick,you
- couldtrythefollowing"dirty"method:
- REPEAT
- IF MOUSEK=2
- joy=3
- ELSE
- joy=BYTE{&HE09} ! forTOS-version1.0!!
- ENDIF
- ON joy GOSUB n,s,fire,w,nw,sw,dummy,e,ne,se
- PAUSE 5
- UNTILcondition!
-
-
- üë16.SOUND
- Ç
-
- üSOUNDÇüandWAVEÇ
-
- AfteraSOUND-command,thesoundsometimescontinuesinspiteofthe
- elapsedtime.IfthecommandisfollowedbyanotherSOUND-oraWAVE-
- command,thetimeishandledcorrectly.ThiscertainlysoundslikeaGFA-
- bug.
-
- Theeasiestwaytostopallsoundis:
- WAVE0,0 !turnallsoundoff
-
- Soundofacertainfrequencycanbeproducedwith:
- SOUNDch,vol,#ROUND(125000/freq%),pause
-
- AlthoughourSTisnotfamousforitsbrilliantsound,youcanproduce
- nicesound-effectswiththesimplecommandsSOUNDandWAVE.Checkoutthe
- ProceduresSiren.sound,Tideli.sound,Bounce1.soundandBounce2.soundto
- hearwhatImean.
-
-
- üDosound(XBIOS32)Ç
-
- XBIOS32(Dosound)canbeusedtoplaymusicinaspecialformat.I
- proposetousetheextension'X32'forsong-filesinthisformat.The
- operatingsystemtakescareofplayingthemusicduringinterrupts(every
- 1/50thsecond).TakealookattheProceduresPlay.songandStop.songto
- seehowyoucoulduseXBIOS32inyourprograms.Youcanevenplayasong
- continuouslywiththeProcedurePlay.cont.song.Temporarilystoppinga
- songispossiblewiththeProcedureInterrupt.song.
-
- IfyouuseXBIOS32toplaymusic,youareadvisedtoswitchthekey-click
- off.Otherwisethemusicwillstopassoonastheuserpressesakey.
-
- OnceIdiscoveredXBIOS32didnotworkduringtheinitialization(mainly
- thefillingofarrays)ofalargeprogram.Ihadconvertedtheprogram
- fromGFA-Basic2.0to3.0,butIdidnothavethepatiencetofindout
- whatcausedthisproblem.
-
- XBIOS32canalsobeusedforsound-effects.Ihavedevelopedthe
- ProcedureInitio.soundforbuildingsound-stringsfromafewDATA-lines.
- Iherebydeclarethisasthestandardmethodforcreatingsound-strings.
- After@do.sound(sound$)youcanhearthesound-effect.Inthefollowing
- examplethesound-stringbounce3$iscreated:
- PROCEDURE initio.sound
- ' *** commands in DATA-lines :
- ' *** REG = 14 parameters for registers 0-13
- ' *** END = end of sound-string
- ' *** PAUSE = pause (followed by time in 1/50 seconds)
- ' *** VAR = decrease/increase tone : channel,start,+/-step,
- '***end-value
- Ç '
- bounce3.sound:
- DATA REG,0,0,0,0,0,0,27,248,16,16,16,35,95,0
- DATA VAR,3,255,-1,116
- DATA PAUSE,255,END
- RESTORE bounce3.sound
- @sound.string(bounce3$)
- RETURN
- '
- PROCEDURE sound.string(VAR s$)
- LOCAL n,snd$,snd,channel,begin,step,end
- s$=""
- DO
- READ snd$
- snd$=UPPER$(snd$)
- EXIT IF snd$="END"
- IF snd$="REG"
- FOR n=0 TO 13
- READ snd
- s$=s$+CHR$(n)+CHR$(snd)
- NEXT n
- ENDIF
- IF snd$="PAUSE"
- READ snd
- s$=s$+CHR$(130)+CHR$(snd)
- ENDIF
- IF snd$="VAR"
- READ channel,begin,step,end
- s$=s$+CHR$(128)+CHR$(begin)+CHR$(129)+CHR$(channel)+CHR$(step)
- s$=s$+CHR$(end)
- ENDIF
- LOOP
- s$=s$+CHR$(255)+CHR$(0) ! terminator
- RETURN
- '
- PROCEDURE do.sound(sound$)
- VOID XBIOS(32,L:VARPTR(sound$))
- RETURN
-
-
- üSamplesÇ
-
- FromGFA-Basicyoucansurprisetheuserwithasampledsound.Examinethe
- ProceduresSample,Load.sampleandPlay.sampletoseehow.You'llhaveto
- findsuitablesamplesfirst.Lookoutforsound-effectsandspeech-
- samples.Personally,IjustlovethefamousPerfect-sample.
- ü
-
- üSpeechÇ
-
- YourSTcantalktoyouwithalittlehelp(STSPEECH.TOS).MycurrentGFA-
- version(3.07)refusestocooperatewiththeProceduresInitio.speechand
- Talk,butIhaveincludedtheseanyway.Perhapsyoucandiscoverthebug.
- InearlierversionsbothProceduresdidwork.Aresetisnecessarybecause
- EXEC3isused.
-
-
- üSoundmachineÇ
-
- Youcanplaysongs,createdwithSoundmachine(TommySoftware),fromGFA-
- Basic.You'llneedtheProceduresInitio.soundmachineandSoundmachine,
- andasong-file.You'llprobablywonderifit'sreallyyourSTthat's
- playingthesong.SoundmachineIIisout,andlooksevenbetter.Inthis
- newversionyoucanchoosebetweenplayingsongswithsamples,orwithout
- samples(orsamplesforoneofthethreechannels).You'llneedthe
- ProcedureSm.initioorMsm.initioandseveralothers.Trytofindthe
- PublicDomaindemo-programsSAMSOUND.GFA,CHIPSND.GFAandSND_PLAY.GFA.
- Endofcommercial,continuewithtext.
-
-
- üë17.PROGRAMDECISIONS
- Ç
-
- üIF...ENDIFÇ
-
- Ifthevalueofacertainvariablemustfallintherangemin%-max%,you
- couldprogramthatasfollows:
- IFn%>max%
- n%=max%
- ENDIF
- IFn%<min%
- n%=min%
- ENDIF
- InthiscaseyoucouldalsouseMAXandMIN:
- n%=MAX(MIN(n%,max%),min%)
-
- Youprobablytestfortwoconditionsbyusing:
- IFcond1!ANDcond2!
- (...) !bothtrue
- ENDIF
- Butseparatetestingismuchfaster:
- IFcond1!
- IFcond2!
- (...) !bothtrue
- ENDIF
- ENDIF
-
-
- üSELECTÇ
-
- Multiple'ELSEIF'-constructionscanbereplacedbya'SELECT'-
- construction.AteachCASEyoucanuseintegers,stringsorinteger-
- variables(ênotÇstring-variables).Onlythefirstfourbytesofastring
- canbeused.TheeditorwillnotacceptsomethinglikeCASE"test2",
- onlyCASE"test".
-
-
-
- üë18.PROGRAMLOOPS
- Ç
-
- üCalculationsÇ
-
- Trytoremoveallunnecessarycalculationsfromloops,e.g.:
- FORi=1TO1000
- x(i)=2*q*i
- NEXTi
- It'sabetterideatocalculate2*qoutsidetheloop:
- q2=q*2
- FORi=1TO1000
- x(i)=q2*i
- NEXTi
-
- Alwaystrytoconvertfloatingpointvariablestointegersbeforeentering
- aloop.Thenyouwillbeabletousethefastinteger-operators.An
- obviousexamplewouldbeacalculationwithdollars(24.37)thatcouldbe
- replacedbyacalculationwithcents(2437).Usethismethodifyouknow
- thelowestpossiblevalueofthefloatingpointvariable(0.01inthis
- case)andthendividebythisvalue.Butwatchoutforroundingerrorsand
- integer-overflow.
-
- Powersof2canbecalculatedfastbysettingabit:
- x%=BSET(0,6) !fasterthanx%=2^6
- Andfortheultimatespeed-freaks,multiplyingwithapowerof2is
- slightlyfasterwithSHL:
- y%=SHL(x%,3) !fasterthany%=MUL(x%,8)
- Ofcoursethereisnooverflow-controlifyouuseSHL(orMUL).
-
- Sometimes,calculationsinaloopcanbereplacedbyalook-uptable:
- FORi=1TO1000
- y%(i)=x|(i)^2
- NEXTi
- First,createatableofsquares:
- DIMsquare%(255)
- FORi=0TO255
- square%(i)=i*i
- NEXTi
- Thenusethistableintheloop:
- FORi=1TO1000
- y%(i)=square%(x|(i))
- NEXTi
-
-
- üFOR...NEXTÇ
-
- IuselocalvariablesinProceduresifpossible.Butifyouintendto
- compiletheprogramlater,youshoulddeclarethecounterinaFOR...
- NEXTloopasaêglobalÇvariable.Inthecompiledprogram,theloopwillbe
- executedfaster!
-
- ÇIfyouusefloatingpointcount-variablesinaFOR...NEXTloop(orany
- otherloop),youcouldencounterunexpectedproblems:
- FORi#=0.1TO0.9STEP0.1
- PRINTi#
- NEXTi#
- Youwouldexpect0.9astheresultofthelastaddition(0.8+0.1),but
- 0.9isneverprinted!ThisisnotabuginGFA-Basic,butcausedbythe
- internal(binary)representationoffloatingpointnumbers.Thelast
- additionresultsinanumberslightlylargerthan0.9andthereforethe
- loopisleftafterprinting0.8.Ifyouinserttheline
- i#=ROUND(i#,14)
- intheloop,youcansolvethisproblem.Butthebestsolutionistoavoid
- floatingpointcount-variablesinloops.Integercount-variablesaremuch
- faster.Youcouldeasilychangetheloopto:
- FORi=1TO9
- PRINTUSING"#.#";i/10
- NEXTi
- Onemoretime:'i'isaword-variable,becauseIuseword-variablesas
- thedefaultfornumber-variableswithoutpostfix.
-
- IfyouuseafloatingpointvariableinaREPEATUNTILloop,youcanavoid
- theroundingerrorbyusingthespecialoperator'==':
- i#=0
- REPEAT
- i#=i#+0.1
- PRINTi#
- UNTILi#==0.9
- Butyoucan'tusethe'=='-operatorinaFOR...NEXTloop.
-
- Inthefollowingtwoexamplesabyte-variableisusedasthecounter:
- FORi|=5DOWNTO-1
- PRINTi|
- NEXTi|
- '
- FORi|=250TO256
- PRINTi|
- NEXTi|
- Ofcourse,abyte-variablecannothaveavalueof-1or256.GFAdoesênotÇ
- abortwithanerror-message,butskipstheloops.Notatruebugperhaps,
- butclose.
-
-
- üLoopsÇ
-
- AlthoughyoucanusemanydifferentloopsinGFA-Basic3.0,thereare
- basicallyonlytwovarieties.Youcanfirsttestacondition,andthen
- eithercontinueorleavetheloop.Oryoucanfirstentertheloop,and
- thentestaconditiontodecideifyouaregoingtocontinueorleave.
-
- InaninterpretedprogramthefirstchoiceisthefastFOR...NEXTloop,
- thenthe(slower)REPEAT...UNTILloopandfinallythe(slowest)WHILE
- ...WENDloop.Inacompiledprogramallloopsareexecutedequallyfast!
- IfyouuseaDO...LOOP,anEXITIFconditionwillalwaystakesomeextra
- time.
- ÇTrytoavoidaênegativeÇtestinaloop,asthiswilltakemoretime.E.g.
- replace:
- WHILENOTcondition!
- (...)
- WEND
- bythemuchfaster:
- DOUNTILcondition!
- (...)
- LOOP
- Orsimilarlyreplace:
- REPEAT
- (...)
- UNTILNOTcondition!
- bythefaster:
- DO
- (...)
- LOOPWHILEcondition!
-
- Finally,youcouldcombinethetestofoneconditionatthestartofthe
- loopwiththetestofanotherconditionattheendoftheloop:
- DOUNTILcondition_1!
- (...)
- LOOPWHILEcondition_2!
-
-
- üë19.PROGRAMCONTROL
- Ç
-
- üGOSUBÇ
-
- AProcedurecanbecalledinoneofthefollowingways:
- GOSUBproc
- @proc
- proc
- Ipreferthesecondmethod,becausethisisspottedeasilyinalisting.
- Also,thesamemethodcanbeusedtocallafunction.
-
-
- üONBREAKGOSUBÇ
-
- Youcan'tstopaprogramifarecursivelycalledfunctionisexecuted(?).
-
- UseONBREAKCONTtopreventcallingtheBreak-Proceduretwice.Nobodycan
- releasethe<Control><Shift><Alternate>keysfastenough:
- ONBREAKGOSUBbreak
- (...)
- PROCEDUREbreak
- ONBREAKCONT
- (...)
- ONBREAKGOSUBbreak
- RETURN
- InthiscasetheBreak-Procedureisactivatedagainbeforeleavingthe
- Procedure.StudytheStandardProcedureBreak(inoneoftheSTANxxxx.LST-
- files)foranexampleofthismethod.
-
-
- üERRORÇ
-
- YoucansimulateERRORswithvaluesfrom-127to127.ForGFA-errorsuse
- valuesfrom0to93,forbomb-errors102(2bombs)to109(9bombs)and
- forTOS-errors-1to-67.
-
-
- üEVERYandAFTERÇ
-
- It'snotpossibletouseEVERYandAFTERatthesametime.Bothcommands
- don'tworkduringalongPAUSEorDELAY(oranyothercommandthattakesa
- lotoftime).YoucanonlycallProcedureswithoutparameters.Don'tmake
- theProceduretoolong,oritmaybecalledwhilebeingprocessed!
-
- Inacompiledprogramyouhavetoincorporate'$I+U+',orEVERYandAFTER
- can'tbeused.
-
-
- üGOTOÇ
-
- Youcan'tuseGOTOinaProcedure,aFunctionoraFOR...NEXTloop.
-
-
- üDELAYÇ
-
- TheDELAY-commanddoesnotoperatecorrectlyinversion3.07ofGFA-Basic.
- DuringDELAYaBreakisimpossible.Anastierbugistheappearanceofthe
- mouse-cursorduringDELAY,evenafterHIDEM.YouareadvisedtousePAUSE
- instead.
-
-
- üCHAINÇ
-
- InGFA-BasicallvariablesandarraysarelostafterCHAINingthenext
- program.However,youcouldusethe160-bytebufferofthescrap-library
- topassashortmessagetothenextprogram:
- buffer$=SPACE$(160) !160bytesmaximum??
- message$="thismessagewassentbythepreviousprogram"
- message$=message$+CHR$(0)
- LSETbuffer$=message$
- r%=SCRP_WRITE(buffer$) !r%=0iferror
- CHAINfile$
- Readthemessagewith:
- buffer$=SPACE$(160)
- r%=SCRP_READ(buffer$)
- message$=CHAR{V:buffer$}
- Theuseofthisbufferiscompletelyillegal,butwhocaresifyoudon't
- useascrap-library?UnfortunatelytheGFA-editorseemstothinksotoo,
- soyoushouldexperimentalittlebeforetrustingthismethod.
-
-
- üEXECÇ
-
- Ifyouaregoingtorunanotherprogrammorethanonce,you'llhavetouse
- EXEC3:
- base%=EXEC(3,file$,"","") !load,butdon'tstartyet
- base$=STR$(base%)
- cmdl$=CHR$(LEN(base$)+1)+base$ !createcommandline
- (...)
- r%=EXEC(4,"",cmdl$,"") !nowrunit
- Thevariabler%containsavaluereturnedbytheprogram(or-39ifnot
- enoughmemorywasavailable).Repeatthelastlineifyouwanttorunthe
- loadedprogramagain.OfcourseyoushoulduseEXEC0ifyou'regoingto
- runtheprogramonetimeonly.Readtheparagraph'RESERVE'ifyouare
- goingtouseEXEC3.
-
- Ifyoucalla'*.PRG'-programwithEXEC0,youpassthenull-string("")
- asthecommand-line.Youneedthecommand-lineonlyifyoucalla'*.TTP'-
- program.Thecommand-lineisconvertedtouppercaseandcan'texceed125
- bytes.Thefirstbyteofthecommand-line(usually)determinesthelength
- oftheline,sothecommand-linecan'tcontainmorethan124characters.
- YoucanusethisinaTTP-program(compiledGFA-Basicprogram,extension
- changedtoTTP),butit'seasiertoreadthecommand-linewith:
- cmdl$=CHAR{BASEPAGE+&H81}
-
-
- üë20.GRAPHICS
- Ç
-
- üSETCOLORandVSETCOLORÇ
-
- WithcommandslikeCOLOR,DEFTEXT,DEFFILL,etc.,youuseaVDIcolour-
- index.UnfortunatelySETCOLORusesadifferenttable:
- VDIcolour-index :0123456789101112131415
- SETCOLOR(Lowrez) :0151246357891012141113
- SETCOLOR(Medrez) :0312
- Fromthistableitfollowsyouwouldhavetouse'SETCOLOR2,r,g,b'to
- changecolour-indexê3Ç.Bytheway,allLine-AcommandsusetheSETCOLOR-
- tableaswell!Thisisnota"bug",butaconsequenceoftwodifferent
- colour-tablesthatareusedbyGEMDOSandGEM.Youareadvisedtouse:
- VSETCOLORindex,r,g,b
- Thisindexisexactlythesameasthecolour-index,soyouwoulduse
- 'VSETCOLOR2,r,g,b'inordertochangecolour-index2.Ifyoulike,you
- couldusethehexadecimal3-bytemix-value:
- VSETCOLORindex,&Hrgb
- Butyouwon'tlikeitatall,becausethisdoesn'tworkproperly.GFA-
- Basicswapsther-andg-byte,soyouwouldhavetouse:
- VSETCOLORindex,&Hbgr
- Betteravoidthismethod,oryou'llexperiencecolour-changesifGFA
- correctsthisbuginafutureversion.
-
- InHighresolutionyoucaninvertthescreen-colourswith:
- VSETCOLOR0,0 !reverseHigh-screen(blackbackground)
- VSETCOLOR1,0 !normalHigh-screen(blackletters)
- Aninvertedscreenisperhapsslightlylesssuitablefortext,but
- graphicslooksuperb.
-
- Colour-index0determinesthecolourofthebackgroundinLowandMedium
- resolution.Thisindexalsodeterminesthecolouroftheborderonyour
- screen.Youcanchangethiscolour,althoughyoucan'tdraworPRINTon
- thescreen-borderofyourcolourmonitor.ThecolourofallPRINTedtext
- isdeterminedbycolour-index1,unlessyouusethe'Escb'command(read
- theparagraph'PRINT'againifyourlong-termmemoryistooshort):
- VSETCOLOR0,r,g,b !changecolourofbackground
- VSETCOLOR1,r,g,b !changecolourofêallÇPRINTedtext
-
-
- üPaletteÇ
-
- Beforechangingcolours,youshouldalwayssavethecurrentpalette.And
- dorestoretheoldpalettebeforetheuserexitstheprogram.Ihate
- programsthatreturntoapinkoryellowdesktop.Youcanstorethe
- paletteeitherinanintegerarrayorinastring,usingXBIOS7
- (Setcolor):
-
- Ç PROCEDURE save.palette
- LOCAL i
- ERASE old.palette%()
- DIM old.palette%(15)
- FOR i=0 TO 15
- old.palette%(i)=XBIOS(7,i,-1)
- NEXT i
- RETURN
- '
- PROCEDURE make.palette.string(VAR pal$)
- LOCAL n
- pal$=""
- FOR n=0 TO 15
- pal$=pal$+MKI$(XBIOS(7,n,-1))
- NEXT n
- RETURN
- Thestring-methodiscompatiblewithDegas.Restoretheoldpalettewith
- thecorrespondingProcedures:
- PROCEDURE restore.palette
- LOCAL i
- FOR i=0 TO 15
- VOID XBIOS(7,i,old.palette%(i))
- NEXT i
- RETURN
- '
- PROCEDURE change.palette(pal.string$)
- VOID XBIOS(6,L:VARPTR(pal.string$))
- RETURN
- YoucouldalsousetheStandardProcedureStandard.low.colorsor
- Standard.med.colorstorestorethedefaultpalette.Youcanfindthese
- ProceduresintheSTANxxxx.LST-files.
-
- Youcanexaminethergb-valueofacertainVDIcolour-indexwith:
- PROCEDURE rgb.value(index,VAR rgb$)
- LOCAL col%
- col%=XBIOS(7,color.index(index),-1)
- rgb$=RIGHT$(HEX$(col%),3)
- RETURN
- TheStandardArraycolor.index()isusedtoconverttheVDIcolour-index.
-
- AcompletelynewpaletteforMediumresolutioncanbeinstalledwith:
- PROCEDURE new.med.colors
- LOCAL n,r,g,b,col$
- RESTORE med.new.col.data
- FOR n=0 TO 3
- READ col$
- r=VAL(LEFT$(col$))
- g=VAL(MID$(col$,2,1))
- b=VAL(RIGHT$(col$))
- VSETCOLORn,r,g,b
- NEXT n
- med.new.col.data
- DATA000,000,000,000
- RETURN
- ÇYoucanshowthecurrentpaletteonthescreenwiththeProcedure
- Palette.box:
- PROCEDURE palette.box(x,y,h,w)
- ' *** left upper corner of rectangle at x,y
- ' *** rectangle-height h; width of one colour-box w
- LOCAL arect.fill,fill.adr%,i,x1,x2
- x2=x+16*w+2
- COLOR black
- BOX x,y,x2,y+h
- arect.fill=-1
- f%=V:arect.fill
- IF low.res!
- FOR i=0 TO 15
- x1=ADD(SUCC(x),MUL(i,w))
- ARECT x1,SUCC(y),ADD(x1,w),PRED(ADD(y,h)),color.index(i),0,f%,0
- NEXT i
- ELSE IF med.res!
- FOR i=0 TO 3
- x1=ADD(SUCC(x),MUL(i,w))
- ARECT x1,SUCC(y),ADD(x1,w),PRED(ADD(y,h)),color.index(i),0,f%,0
- NEXT i
- ENDIF
- RETURN
-
- Youcandarkenthescreenbydimmingallcolourssimultaneouslywiththe
- ProcedureDim.colors:
- PROCEDURE dim.colors(reg1,reg2,val)
- ' *** dim colours from VDI colour-index reg1 to reg2 with val
- ' *** for val=1 colour 254 (rgb) will become 143
- LOCAL i,r,g,b
- FOR i=reg1 TO reg2
- @rgb.value(i,rgb$)
- r=MAX(PRED(VAL(LEFT$(rgb$))),0)
- g=MAX(PRED(VAL(MID$(rgb$,2,1))),0)
- b=MAX(PRED(VAL(RIGHT$(rgb$))),0)
- VSETCOLOR i,r,g,b
- NEXT i
- RETURN
-
- NothingisimpossibleinGFA-Basic,evencolour-cyclingiseasywith
- EVERY intheProcedureColor.cycle:
- PROCEDURE color.cycle(reg1,reg2,time)
- ' *** cycles colours from VDI colour-index reg1 to reg2
- ' *** global : COLOR.CYCLE! COL.REG1 COL.REG2
- IF NOT color.cycle!
- col.reg1=reg1
- col.reg2=reg2
- color.cycle!=TRUE
- EVERY time GOSUB cycle.once
- ELSE
- color.cycle!=FALSE
- EVERY STOP
- ENDIF
- RETURN
- Ç '
- PROCEDURE cycle.once
- LOCAL col1%,col2%
- col1%=XBIOS(7,color.index(col.reg2),-1)
- FOR reg=col.reg1 TO PRED(col.reg2)
- col2%=XBIOS(7,color.index(reg),-1)
- ~XBIOS(7,color.index(reg),col1%)
- SWAP col1%,col2%
- NEXT reg
- ~XBIOS(7,color.index(col.reg2),col1%)
- RETURN
- CalltheProcedureColor.cycleagaintostopthecolour-cycling.
-
-
- üDEFMARKÇ
-
- Thepointasmark-symbol(No.1)cannotbeenlarged.Othermark-symbols
- canbeenlarged,butalllinesinthesymbolretainawidthofonepixel.
- Thesizeofasymbolmustbeamultipleof11plus6:0,17,28,39,50.
- Foravalueinbetween,thepriorallowedsizeischosen.Perhapsthereis
- somemagichiddenintheallowedsizes,oramImissingsomething?
-
-
- üDEFFILLÇ
-
- Ifyouhaven'tdefinedyourownFill-pattern,theAtari-symbolwillbe
- usedafterDEFFILL1,4,x.ThedesktopFill-patternisDEFFILL1,2,4.
-
- TheFill-patternstringcanconsistof16,32or64words(MKI$-format).
- Word1to16isneededforbitplane0(Highresolution),word17to32for
- bitplane1(Mediumresolution)andword33to64forthebitplanes2and3
- (Lowresolution).Inallresolutions,thepatternoccupiesarectangleof
- 16x16pixelsonthescreen.Thesame16x16rectangleisalsousedforthe
- mouse-cursorandsprites.YoucanalwaysuseaFill-patterninaêlowerÇ
- resolution,e.g.aHigh-patterninMediumorLowresolution,butnotthe
- otherwayaround.ExaminethethreeProceduresInitio.high.fill1,
- Initio.med.fill1andInitio.low.fill1toseehoweasyyoucandesignyour
- ownFill-patterns.There'sgoldinthemtharFills.Youcouldsurprisethe
- userwithabomb-pattern:
- PROCEDURE initio.bomb.fill
- ' *** global : BOMB.FILL$
- RESTORE bomb.fill
- @make.high.fill(bomb.fill$)
- bomb.fill:
- DATA 0000011000000000
- DATA0010100100000000
- DATA0000000010000000
- DATA0100100001000000
- DATA 0001000111110000
- DATA 0000000111110000
- DATA 0000011111111100
- DATA 0000111111111110
- DATA 0000110111111110
- DATA 0001111111111111
- Ç DATA 0001111111101111
- DATA 0000111111101110
- DATA 0000111111011110
- DATA 0000011111111100
- DATA 0000001111111000
- DATA 0000000011100000
- RETURN
- '
- PROCEDURE make.high.fill(VAR fill$)
- LOCAL i,pat$,pat%
- CLR fill$
- FOR i=1 TO 16
- READ pat$
- pat%=VAL("&X"+pat$)
- fill$=fill$+MKI$(pat%)
- NEXT i
- RETURN
-
- Becareful,ascreenfilledwiththispatternmightprovokeaheart-
- attack.Ifitdoesn't,youcouldtrythefollowingdirtytrick(High
- resolutiononly)withtheProceduresBusyandAchtung:
- @busy !lookslikethecomputerisverybusy
- ~INP(2) !butnothinghappens,untiltheuserpressesakey...
- @achtung
- PAUSE500
- CLS
- PRINT"Thankyouforyourpatience,I'mnotbusyanymore..."
- PAUSE150
-
- ManyFill-patternsareavailableasfiles.Youcanusethesewith
- somethinglikeProcedureInitio.fill1:
- PROCEDURE initio.fill1(VAR pattern$)
- LOCAL bytes
- bytes=32 ! 32 bytes for High resolution
- ' *** load Fill-pattern (32 bytes for High resolution) here
- INLINE fill1%,32
- pattern$=STRING$(bytes,0)
- BMOVE fill1%,V:pattern$,bytes
- DEFFILL ,pattern$
- RETURN
-
- FILLingascreenwithapatterntakessometime,especiallyinHigh
- resolution.Usethefollowingmethodforalmostimmediatefillingofthe
- entireHighresolutionscreen:
- PROCEDUREfull.fill(fill%)
- ACLIP1,0,0,639,399
- ARECT0,0,639,399,1,0,fill%,15
- ACLIP0,0,0,639,399
- RETURN
- Fill%istheaddressofaFILL-pattern(32bytes).Thisveryfast
- alternativeFill-methodworksinHighresolutiononly.
-
-
- üDEFLINEÇ
-
- After'DEFLINE,n'allhorizontallineshaveawidthofnpixels(nshould
- beodd),exceptinMediumresolution.Butifnislargerthan1,all
- verticallinesaren+2pixelswide!Ihavetroublecountingthepixels
- inMediumresolution.Ithinkthewidthofhorizontallinesis:
- n: 13579
- width : 11335etc.
- Isthisdocumentedanywhere?
-
- YoudefineyourownLine-patternsbyusinganegative16-bitvalue(from
- -&X1to-&X1111111111111111).Eachsetbitcorrespondswithapixelinthe
- Line-pattern(Highresolution).Thehighestbit(15)correspondswiththe
- leftmostpixelofthepattern.Don'tgetconfusediftheeditorchanges
- thenegativebinarynumberyouenteredasapattern.Theeditorusesa
- specialnotationfornegativebinarynumbers.
-
- GFA-Basicrepresentsintegernumbersasbinarystringsof32bits.The
- mostsignificantbit(31)determinesthesignoftheinteger.Ifthisbit
- is0,theremaining31bitsrepresentan"ordinary"positivenumber.But
- ifthemostsignificantbitis1,theremainderisanegativenumberin
- 'two'scomplement'notation.Iwon'ttrytoexplainthat.Inanycase,the
- nexttimeyoutype-&X111andafriendiswatchingyou,don'tblinkyour
- eyes,butcasuallyremark"ofcoursetheeditorconvertsthisintotwo's
- complementnotation".That'salsothereasonGFA-Basiccanworkwith
- integersfrom-(2^31)to+(2^31)-1.
-
-
- üDEFTEXTÇ
-
- Insomepublicationsyoucanreadabout'shadowedtext'(style=32),but
- unfortunatelyourGEMdoesn'tknowthisstyle.Youcanevenfindthemask
- forshadowedtextwithWORD{L~A+92},butit's0.
-
- Ineversucceededinfindingthecurrenttext-stylewithVDISYS38
- (vqt_attributes).EitherabuginGEMormymistake.Idon'twanttoknow,
- becausetheeasywayis:
- txt.style=WORD{L~A+90}
- ThiscouldbeimportantifyouintendtouseDEFTEXTinaProcedure,but
- wouldliketorestoretheoriginalDEFTEXT-settingsbeforeleavingthe
- Procedure.
-
- WithDEFTEXTyoucansettheheightofTEXT-letters.Aletteroccupies
- morespacethough,determinedbytheletter-box:
-
- êletter-heightÇ êletter-boxÇ êsystem-fontÇ
- 4 6x6 icon
- 6 8x8 Medium&Lowrez
- 13 8x16 Highresolution
-
- Theletter-heightisthedistancefromDescent-LinetoAscent-Line,but
- theBottom-LineandTop-Linelieatleastonepixellower/higher.The
- heightoftheletter-boxisthedistancefromBottom-LinetoTop-Line.
-
- ÇMostlettersrestontheBase-Line,butletterswithadescender(g,j,p,
- etc.)restontheDescent-Line.Ifyouarestillwithme,fromtopto
- bottomwehavethefollowinglines:
- Top-Line
- Ascent-Line
- Base-Line
- Descent-Line
- Bottom-Line
- Dropmealineifyoudon'tunderstandthis.
-
-
- üGRAPHMODEÇ
-
- IfyoudrawarectanglewithBOXinGRAPHMODE3(Xor-mode),thepixelin
- theleftuppercornerisnotdrawn.Actuallythispixelisdrawntwice,
- andinGRAPHMODE3thismeansthepixeldisappears.UsePLOTtodrawthis
- pixel:
- GRAPHMODE3
- BOXx1,y1,x2,y2
- PLOTx1,y1 !andfillthegap
-
- WithPBOXinGRAPHMODE3you'llalsogettroubleinthesamecorner.Avoid
- thisbyusingthecommand'BOUNDARY0'first:
- GRAPHMODE3
- BOUNDARY0
- PBOX50,50,100,100
-
- GRAPHMODE3isespeciallyusefulifyoumakeatemporarydrawing.Drawthe
- samepictureasecondtimetorestoretheoriginalscreen.ExamineProce-
- dureslikeRubber.line,Draw.boxandDrag.boxforexamplesofthismethod.
- TheProcedureRubber.lineisusedtodrawalinefrom(x,y)tothemouse-
- cursor:
- PROCEDURE rubber.line(x,y,VAR x2,y2)
- LOCAL x1,y1,x2,y2,k
- GRAPHMODE 3
- DEFMOUSE 3
- SHOWM
- MOUSE x1,y1,k
- REPEAT !mainloop
- LINE x,y,x1,y1 !drawline
- REPEAT
- MOUSE x2,y2,k
- UNTIL x2<>x1 OR y2<>y1 OR k>0 !mousemoved
- LINE x,y,x1,y1 !undrawline
- x1=x2
- y1=y2
- UNTIL k>0 !mouse-click:ready(x2andy2returned)
- GRAPHMODE 1
- LINE x,y,x2,y2 !thisisit
- HIDEM
- DEFMOUSE 0
- PAUSE 10
- RETURN
-
- ÇYoucouldalsousethe'GRAPHMODE3'-methodforanimation,buttheXBIOS5
- (Setscreen)methodismoresuitable.
-
- Don'ttrytodrawinGRAPHMODE3withalinewidthgreaterthan1pixel.
- GEMwillsurpriseyouwithsomemodernartifyoucan'tresistthe
- temptation.
-
- Ifyouwanttoconfirmaparticularchoiceoftheuser,youcaninvertthe
- relevantpartofthescreenwiththeProcedureInvert.block.Callthis
- Procedureagainwiththesameparameterstorestoretheoriginalscreen:
- PROCEDURE invert.block(x1,y1,x2,y2,color)
- GRAPHMODE 3
- DEFFILL color,1
- BOUNDARY 0
- PBOX x1,y1,x2,y2
- BOUNDARY 1
- GRAPHMODE 1
- RETURN
-
- Youcan'greyout'anunavailableoptiononthescreenwith:
- PROCEDURE block.dimmer(x1,y1,x2,y2,color)
- GRAPHMODE 3
- DEFFILL color,2,2
- BOUNDARY 0
- PBOX x1,y1,x2,y2
- BOUNDARY 1
- GRAPHMODE 1
- RETURN
- CallthisProcedureagaintorestorethescreen.
-
- Theentire(Highresolution)screencanbedimmedwith:
- PROCEDURE screen.dimmer
- ' *** global : DIMMER.SCREEN$DIMMER.SWITCH!
- IF dimmer.switch!
- SPUT dimmer.screen$
- dimmer.switch!=FALSE
- ELSE
- SGET dimmer.screen$
- GRAPHMODE 4
- DEFFILL 1,2,4
- PBOX 0,0,639,399
- dimmer.switch!=TRUE
- ENDIF
- RETURN
- ThescreenwillberestoredifyoucalltheProcedureagain.
-
-
- üPLOTandDRAWÇ
-
- Youcanuseboth'PLOTx,y'and'DRAWx,y'tosetapointonthescreen.
- Thesizeofthepointcanbechanged:
- DEFLINE,size,2,2 !changesizeofpoints
- ÇButtheshapesyou'llseedon'tlooklikepointsanymore,duetothesame
- problemasdescribedintheparagraph'DEFLINE'.UsePCIRCLEforproper
- fatpoints.
-
-
- üPCIRCLEÇ
-
- WithCLIPon,aPCIRCLEtouchingtheupperscreen-borderisnotfilled
- properlyinHighresolution:
- CLIP0,0,640,400
- PCIRCLE0,0,50
- Idon'tknowifweshouldblameGFAorGEMfornotfillingthetwotop-
- linesinthecircle.
-
-
- üCURVEÇ
-
- WiththecommandCURVEyoucandrawaBezier-curve:
- CURVEx1,y1,x2,y2,x3,y3,x4,y4
- TheBezier-curvestartsat(x1,y1)andendsat(x4,y4).Theothertwo
- pointsactlikelittlemagnets.Youcanalsousethiscommandtodrawa
- 'normal'curvebetweentwopointsbylettingthepoints(x3,y3)and
- (x4,y4)coincide.TrythefollowingtoseewhatImean:
- GRAPHMODE3
- MOUSEx2,y2,k
- DO
- CURVE10,100,x2,y2,110,100,110,100 !drawcurve
- REPEAT
- MOUSEx,y,k
- UNTILx<>x2ORy<>y2
- CURVE10,100,x2,y2,110,100,110,100 !erasecurve
- x2=x
- y2=y
- LOOP
- Thismethodcouldbeusedtodrawlargeletters.
-
-
- üTEXTÇ
-
- ThecoordinatesusedwithTEXTdeterminethestartoftheêBase-LineÇofthe
- text.Thedescendersofletterslike'g','j',and'p'liebelowtheBase-
- Line.Thisisespeciallyimportant,nottosayfrustrating,ifyouuse
- TEXTwithanangleof90,180or270degrees.Thetextrotatesanticlock⑨
- wisearoundtheTEXT-coordinates!
-
- IfyouintendtocombinePRINTedtextwithTEXT,youprobablywilllike
- theProcedureText.atastheanalogueof'PRINTAT':
- PROCEDURE text.at(c,l,t$)
- TEXT (c-1)*char.width,l*char.height+3*high.res!+2*(NOT high.res!),t$
- RETURN
-
- ÇYoucanuseTEXTtoprint"digital"numbers(ASCII-code16-25):
- FUNCTION digital$(number$)
- LOCAL dig$,i
- CLR dig$
- FOR i=1 TO LEN(number$)
- dig$=dig$+CHR$(BCLR(ASC(MID$(number$,i,1)),5))
- NEXT i
- RETURN dig$
- ENDFUNC
- UsethisFunctionasfollows:
- TEXT x,y,@digital$("1237")
-
-
- üSPRITEÇ
-
- YoucoulddesignandsavespritesäinvitroÇwithoneofthemanySprite-
- editorsthatareavailable.OryoucanusesomethingliketheProcedure
- Initio.sprite1tocreateaspriteäinvivoÇ.ComparethisProcedurealso
- withtheProcedureInitio.mouse1:
- PROCEDURE initio.sprite1
- ' *** global : SPRITE1$
- RESTORE pattern.sprite1
- @make.sprite(sprite1$)
- pattern.sprite1:
- ' *** x,y,mode(0=normal;1=XOR),mask-colour,sprite-colour
- DATA 0,0,0,0,1
- ' *** mask-pattern (1 = pixel on , 0 = pixel off)
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- ' *** sprite-pattern
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- Ç DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- DATA 0000000000000000
- RETURN
- '
- PROCEDURE make.sprite(VAR s$)
- LOCAL x,y,mode,msk.color,spr.color,n,msk%,spr%,msk.pat$,spr.pat$
- LOCALmsk$,spr$,pat$
- CLR msk.pat$,spr.pat$,pat$
- READ x,y,mode,msk.color,spr.color
- FOR n=1 TO 16
- READ msk$
- msk%=VAL("&X"+msk$)
- msk.pat$=msk.pat$+MKI$(msk%)
- NEXT n
- FOR n=1 TO 16
- READ spr$
- spr%=VAL("&X"+spr$)
- spr.pat$=spr.pat$+MKI$(spr%)
- NEXT n
- FOR n=1 TO 16
- pat$=pat$+MID$(msk.pat$,n*2-1,2)+MID$(spr.pat$,n*2-1,2)
- NEXT n
- s$=MKI$(x)+MKI$(y)+MKI$(mode)+MKI$(color.index(msk.color))
- s$=s$+MKI$(color.index(spr.color))+pat$
- RETURN
- Themaskshouldbeanexactcopyofthesprite-patternifyouneeda
- transparantsprite.Leavethemaskempty(all'0')andthespritewill
- disappearbehindobjectsonthescreen.Fillthemaskwith'1'andthe
- 16x16spritewillalwaysremainvisible.Switchmask-andsprite-colourin
- thefirstDATA-linetocreatea"reverse"sprite.OruseanyVDIcolour-
- indexthatisavailableinthecurrentresolution.
-
- Ifyouputaspriteonthescreen,thebackground(16x16pixels)is
- temporarilysaved.Usingmorethanonespritesimultaneously,itis
- essentialyouremovespritesinreverseorder.Thisisnecessarybecausea
- spritecouldoverlapanothersprite.Removingthetopspritefirstensures
- thattheoriginalbackgroundwillreappearafterremovingthefirst
- sprite,e.g.:
-
- DO
- (...)
- SPRITEs2$ !removesprites...
- SPRITEs1$
- VSYNC !preventsblinking,butslowsdown
- SPRITEs1$,x1,y1 !drawsprites...
- SPRITEs2$,x2,y2
- (...)
- LOOP
-
-
- üVQT_EXTENTÇ
-
- ThefunctionVQT_EXTENTcanbeusedifyouwouldliketodrawarectangle
- aroundatext-string:
- ~VQT_EXTENT(txt$,x1,y1,x2,y2,x3,y3,x4,y4)
- Thecoordinatesofthefourcornersdependontheangleofthetext(0,
- 90,180or270degrees)andofcourseonthesizeofthetext.Thepoint
- (x1,y1)isthelowerleftcorneroftheimaginaryrectanglearoundthe
- textandtheotherpointsarearrangedanticlockwisearoundthetext-
- string.BecausethetextrotatesaroundtheTEXT-coordinates(startofthe
- Base-Line),itwilltakesometrialanderrortodeterminethecorrect
- positionoftherectangleiftheangleisnot0degrees.Inthefollowing
- tableyou'llfindthe"true"originoftherectangle,thewidthandthe
- heightoftherectangle,andalsotheactualpositionofthelowerleft
- cornerofthetext-block(x1,y1):
- êangleÇ êposition(x1,y1)Ç êoriginÇ êwidthÇ êheightÇ
- 0 lowerleft x1,y1 x2 y4
- 900 lowerright x4,y4 x1 y3
- 1800 upperright x3,y3 x4 y2
- 2700 upperleft x2,y2 x3 x4
- Thecoordinatesoftheoriginare(0,0),sowithanangleof0degrees
- bothx1andy1are0.Therectanglerestsonthex-axis,whiletheleft
- sidecoincideswiththey-axis.Thisisa"mathematical"y-axis,nota
- "screen"y-axis.Thismeansyougoupwardsforpositivey-values.Foran
- angleof0degreesthecoordinateswillbe:
- (x4,y4)..(x3,y3)
- .TEXTBLOCK.
- (x1,y1)(x2,y2)
-
- Ifyouunderstandthetable,youshouldbesurprisedbytheheight'x4'
- insteadof'y1'atanangleof270degrees.IthinkIdiscoveredabugin
- GEMhere.CorrectGEMbychangingthefollowingvariablesifanangleof
- 270degreesisused:
- y1=x4
- SWAPx4,y4
- Now,theheightis'y1'asyoususpected.Clever,aren'twe?Ihavenot
- beenabletoconfirmmydiscovery.Noneofmyreference-booksmentionthe
- bug.
-
-
- üLine-AÇ
-
- TheLine-AcommandsarefasterthanthecorrespondingVDI-commandsinGFA-
- Basic.ThedifferenceshouldbeevengreaterafterloadingGDOS(?).In
- thefollowingtableyoucanfindhowmanytimesfastertheLine-Acommand
- is:
- PSET/PLOT=3
- PTST/POINT=2
- HLINE/LINE=2
- ARECT/PBOX=1.5
- ThesyntaxofLine-Acommandsismorecomplicated,butthat'snoproblem
- forusGFA-experts.Line-Acommandsusethe'SETCOLOR-index',soyou'll
- probablyneedtheStandardArraycolor.index().
-
- üHLINEÇ
-
- AnadditionaladvantageofthecommandsHLINE,ARECTandAPOLYisthatyou
- don'thavetochangetheDEFFILL-parametersinthemainprogram.Forsolid
- horizontallines,use:
- pattern=-1
- adr%=V:pattern
- HLINEx1,y,x2,color,mode,adr%,0
- Youcan'tuse&X1111111111111111(16bits)forthepattern,becausebit15
- ofaword-variableisaflagforanegativenumber.Yes,that'swhythe
- largestpositivewordis2^15-1(32767).Thesolutiontothislittle
- problemistoassign-1totheword-variable.Youhavemyword,nowall16
- bitsare1.UseBIN$ifyoudon'tbelieveme.
-
- Forverycomplicatedpatternsyoucoulduseaword-array:
- DIMpattern(i)
- adr%=V:pattern(0)
- (...) !putfill-patterninpattern(0)topattern(i)
- HLINEx1,y,x2,color,mode,adr%,i
-
-
- üACHARÇüandATEXTÇ
-
- It'sdifficulttocombinetheLine-AcommandsACHARandATEXTwithTEXT.
- ThecoordinatesusedwithACHARandATEXTdeterminethepositionofthe
- leftuppercornerofthe(first)letter-box.That'stheTop-Line,ênotÇthe
- Base-Line.
-
- Youcan'tusethetext-styleunderlined(8)withACHARandATEXT.Probably
- aGFA-bug.
-
-
- üGETandPUTÇ
-
- Youcouldsavearectangularpartofthescreenasfollows:
- GETx1,y1,x2,y2,pic$
- BSAVEfile$,V:pic$,LEN(pic$) !usetheextensionPUTinthefilename
-
- Later,youcouldputthesavedpicturebackonthescreenwith:
- OPEN"I",#1,file$
- LETbytes%=LOF(#1) !howmanybytesneeded?
- CLOSE#1
- picture$=SPACE$(bytes%) !reservesomespace,
- BLOADfile$,V:picture$ !loadthepicture
- PUTx,y,picture$ !andlookatit
-
- TheProceduresMessage,Warning,Message.onandMessage.offuseGETand
- PUTtosaveandlaterrestorethepartofthescreenthatisusedfor
- text.
-
- ÇAGET-stringstartswiththreewordsforwidth,heightandnumberof
- bitplanes.Thenumberofbitplanesisdeterminedbytheresolution:1for
- High,2forMediumand4forLow.Afterthesethreewordsfollowsthe
- actualpictureasalistofwords.Asthepicture-widthisnotnecessarily
- amultipleof16,anybitsbeyondtherightborderwillbeignoredbythe
- PUT-command.
-
- HereistheconnectionbetweenGRAPHMODEandPUT-mode:
- êGRAPHMODEÇ êPUT-modeÇ
- 1 3(default)
- 2 7
- 3 6
- 4 13
-
- IhaveencounteredafewprogramsinGFA-Basic2.0wherePUTwasused
- justoutsidethescreen.InGFA-Basic3.0theprogramdidn'twork.The
- sameoccurredinaprogramwhereapicturewasBLOADedafewbytesbefore
- thescreen-RAM.Idon'tunderstandwhyGFA-Basic3.0doesn'tacceptthis,
- asthereissomeunusedspacethere(readtheparagraph'RAM'),butI've
- learnedtocorrectthiswhenIconvertaprogramfromGFA-Basic2.0to
- version3.0.
-
-
- üDegas-PicturesÇ
-
- ADegaspicture-filecontainsnotonlytheactualpicture(sameformatas
- SGET-picture),butalsothecolour-palette.UsetheProcedureShow.degas
- toloadandshowaDegas-picture:
- PROCEDURE show.degas(degas$)
- LOCAL degas.picture$,degas.picture%,degas.palette$
- LOCALdegas.palette%
- degas.picture$=SPACE$(32000)
- degas.picture%=VARPTR(degas.picture$)
- degas.palette$=SPACE$(32)
- degas.palette%=VARPTR(degas.palette$)
- OPEN "I",#90,degas$
- SEEK #90,2 !skipresolution
- BGET #90,degas.palette%,32 ! load palette of picture
- SEEK #90,34
- BGET #90,degas.picture%,32000 ! load actual picture
- CLOSE #90
- ~XBIOS(6,L:degas.palette%) ! change palette
- SPUT degas.picture$ ! show the picture
- RETURN
-
- TheoriginalDegas-fileshavealengthof32034bytes:
- 1word -resolution
- 16words -palette
- 16000words -picturedata
- YoucanuseBTSTtochecktheresolution(bit0=Low,bit1=Medium,bit
- 2=High),butyoucouldalsolookattheextensionofthefilename
- (PI1/PI2/PI3forLow/Medium/High).InthesecondDegas-version(Degas
- Elite),16wordsfor"colour-animation"canbeaddedafterthepicture
- data.
- ÇADegasElitepicturecan(andreallyshould!)besavedinacompressed
- format.TheextensionsPC1/PC2/PC3areusedforLow/Medium/High
- resolution.Also,thehighestbitoftheresolution-wordissetasaflag
- foracompressedpicture.WiththeProcedureShow.comp.degasyoucanload
- andshowacompressedDegas-picture.
-
-
- üNeochrome-PicturesÇ
-
- Sometimesthe"Neochrome"-formatisusedforpictures(32128bytes):
- 1integer -resolution(0/1/2forLow/Medium/High)
- 16words -palette
- 12bytes -filename(nnnnnnnn.eee)
- 4bytes+1word -colouranimationdata
- 18integers -reserved
- 16000words -picturedata
-
-
- üVSYNCÇ
-
- TheVSYNC-commandisusefulifyouwanttopreventirritatingblinking
- duringanimation.AlwaysVSYNCbeforedrawinganewpictureinan
- animationsequence(includingSPRITE-animation).Theprogramisslowed
- downofcourse,becauseitwaitsforaverticalblankinterruptbefore
- startingtodraw.Butitlooksmuchnicer.
-
-
- üScrollÇ
-
- WithBMOVEandRC_COPYyoucanaccomplishprettysmoothscrolling.GET/PUT
- istooslow,andonlyworksonthelogicalscreen.BITBLTismore
- flexible,butalsomorecomplicated.Andnotfaster(?).Studythe
- ProceduresScroll.upandScroll.downtoseehowyoucouldscrollthe
- entirescreenupordown:
-
- PROCEDURE scroll.up(scroll.lines,scroll.color)
- LOCAL n,bytes,move.bytes,source%
- IF high.res!
- LET bytes=80*scroll.lines
- ELSE
- LET bytes=160*scroll.lines
- ENDIF
- move.bytes=32000-bytes
- source%=physbase%+bytes
- VSYNC
- BMOVE source%,physbase%,move.bytes
- DEFFILL scroll.color
- PBOX 0,scrn.y.max-scroll.lines+1,scrn.x.max,scrn.y.max
- FOR n=1 TO DIV(scrn.y.max,scroll.lines)
- VSYNC
- BMOVE source%,physbase%,move.bytes
- NEXT n
- RETURN
- ÇCananybodyexplaintheinterferencelinesthatsometimesappearduring
- thescrolling?
-
- Severalfade-overeffectscanbefoundintheProceduresUp.scroll,
- Slider.scroll,etc.MostProcedurescanonlybeusedinHighresolution.
-
- Forscrollingofoneormoretext-linesyoucouldusetheProcedures
- Scroll.text.upandScroll.text.down:
- PROCEDURE scroll.text.up(begin,end)
- LOCAL screen%,sx,sy,w,h,dx,dy
- IF begin>1 AND end>=begin
- screen%=XBIOS(3) ! logical screen
- sx=0
- sy=(begin-1)*char.height
- w=scrn.x.max
- h=(end-begin+1)*char.height
- dx=0
- dy=sy-char.height
- RC_COPY screen%,sx,sy,w,h TO screen%,dx,dy
- ELSE
- PRINT bel$;
- ENDIF
- RETURN
- ThismethodisalsousedintheProcedureDebug.
-
-
- üACLIPÇ
-
- Line-Acommandsare'CLIP-sensitive',soyoushouldalwaysuseanappro⑨
- priateACLIP-commandbeforeaLine-Acommand.ThefollowingLine-A
- commandsareênotÇinfluencedbyACLIP:ALINE,HLINE,PSET,PTSTand
- BITBLT.
-
-
- üBlitterÇ
-
- TheBlitter-TOS(1987)allowsyoutoswitchtheBlitteron/off.Icouldn't
- testthefollowingProcedure,becauseIdon'thaveaBlitter.ButifI
- understandthefunctionXBIOS64(Blitmode)correctly,youcouldswitch
- theBlitteronandofffromGFA-Basic:
- PROCEDUREblitter(switch!)
- LOCALstatus
- status=XBIOS(64,-1)
- IFBTST(status,1) !Blitteravailable?
- IFswitch!
- status=BSET(status,0) !Blitteron
- ELSE
- status=BCLR(status,0) !Blitteroff
- ENDIF
- ~XBIOS(64,status) !doit
- ENDIF
- RETURN
-
- ÇBytheway,LineAcommandsdonotusetheBlitter.TheBlitter-chip
- containsahardware-routinethatreplacestheLineABitBlt-function
- (BITBLTinGFA-Basic).AllMegaST'shaveaBlitterinstalled.
-
-
- üë21.EVENTS
- Ç
-
- üMENU()
-
- ÇThereisnoeasywaytotestinaprogramifanaccessoryhasbeen
- selectedbytheuser.MENU(1)lookspromising,butthevalue40(select
- accessory)or41(closeaccessory)isonlysenttotheaccessory!It
- wouldhavebeennicetobeabletodetermineifanaccessoryhasbeen
- closed,becauseGEMwillcleartheaccessory-windowandwillfillthe
- spacewiththedesktop-pattern.Noeasysolutionforthisone,sorry.The
- bestideaprobablyistotestfrequentlywith'IFMENU(1)=20'ifaredraw
- isnecessary,e.g.:
- ONMENUMESSAGEGOSUBredraw
- (...)
- PROCEDUREredraw
- IFMENU(1)=20
- (...) !redrawscreen
- ENDIF
- RETURN
- Thismethodonlyworksifyouhaveopenedawindow.
-
-
- üONMENUBUTTONÇ
-
- ThesyntaxforONMENUBUTTONis:
- ONMENUBUTTONclicks,button,eventGOSUBproc
- Forboth'button'and'event'youcanusethenumbers0-3.Thevariable
- 'clicks'standsfortheêmaximalÇnumberofclicksyouwanttoregister.If
- youchoose'2',theProcedurewillbecallediftheuserclicksonceor
- twice:
- ONMENUBUTTON2,1,1GOSUBproc
- It'snotpossibletowaitforadouble-click,unlesstheprogamisreally
- waiting,andnotdoinganythingelse:
- SELECTEVNT_BUTTON(2,1,1)
- CASE1
- 'clickedonce
- CASE2
- 'clickedtwice
- ENDSELECT
- Butyoucan'tcombinethiswithanONMENUloop.
-
- Ifyouusethedescribedmethod:
- ONMENUBUTTON2,1,1GOSUBproc
- youcoulduseMENU(15)inthecalledProceduretocheckiftheuser
- clickedtwice.ThesameProcedurewouldbecalledafterasingleclick,
- butyoucouldignorethat.Fastenyourseatbeltsnow.Ifyourunsucha
- programthefirsttime,adoubleclickisênotÇregisteredinMENU(15).If
- yoususpectabugandruntheprogramagain,MENU(15)worksallright.
- Nasty.
-
- ÇAnotherbug,butthistimeaGEM-bug(Ithink),after:
- ONMENUBUTTON1,2,2GOSUBproc
- TheProcedureiscalledimmediately,whethertherightmouse-buttonwas
- pressedornot.
-
- IfyouwanttoswitchONMENUBUTTONtemporarilyoff,use:
- ONMENUBUTTONclicks,button,eventGOSUBdummy
- TheProcedureDummyshouldbeempty.Usethesamemethodtoswitchother
- ONMENUcommandstemporarilyoff.
-
-
- üONMENUIBOXÇ
-
- YoucandefinetwoindependentrectangleswithONMENUIBOXand/orONMENU
- OBOX,either:
- -oneIBOXandoneOBOX
- -twoIBOXes
- -twoOBOXes
-
-
- üë22.PULLDOWNMENU
- Ç
-
- üOPENW0Ç
-
- Evenifyoudon'tneedawindow,youcould'OPENW0'ifyouusea
- pulldownmenu.Thetopline(y-coordinates0to18inHighresolution,
- that'swhereyourmenuis)isnowprotectedagainstaccidentaldrawing.
- After'OPENW0'19isalwaysaddedtothey-coordinate,sowith'PLOT0,0'
- thepointisactuallydrawnat(0,19).
-
-
- üDesk-submenuÇ
-
- TheêfirstÇsubmenuinapulldownmenushouldbetheDesk-submenu('Desk'),
- usuallywiththefollowinglay-out:
- Info
- ------------
- Accessory1
- Accessory2
- (...)
- IftheuserchoosestheInfo-item,youshouldshowsomeinformationabout
- theprogram.TheAEStakescareoftheaccessory-items,yousimplyuse
- '1,2,3,4,5,6'inthecorrespondingDATA-line.Ifyouuse'-,-,-,-,-,-'the
- userwon'tbeabletochooseanaccessoryfromyourprogram,butall
- loadedaccessoriesstilloccupymemory.
-
-
- üFile-submenuÇ
-
- Mostpulldown-menu'scontainaFile-submenu('File')astheêsecondÇ
- submenu.Thefollowinglay-outismoreorlessstandard:
- Newfile ^N
- Openfile... ^O
- -----------------
- Close ^C
- Save ^S
- Saveas... ^M
- Abort ^A
- -----------------
- Quit ^Q
- With'...'youannouncethatfurtherinputfromtheuserwillbe
- requested.Ifatallpossible,youshouldofferoptionalkeyboard-
- alternativesfortheexperienceduser.With'^N'youremindtheuserof
- the<Control><N>alternative.ThecharacterwithASCII-code7isusedas
- thesymbolfor<Alternate>.Bygeneralagreement,theQuit-choicealways
- isthelastitemoftheFile-submenu.
-
- Bytheway,neverleavethelast(rightmost)submenuwithoutoptions,e.g.
- duringdevelopmentofaprogram.Theremustbeatleastoneoptioninthe
- lastsubmenu,orit'sreset-timeagain.
-
-
- üë23.WINDOWS
- ê
-
- üGFA-windowsÇ
-
- You'llnoticethatthischapterisrathershort.Thisreflectsmy
- reservationsabouttheuseofwindows.Iknowveryfewprogramsthatuse
- windowssensibly.FortheseprogramsGEM-windowsindeedareablessing.
- Butmostprogramsarebetteroffwithoutwindows.GEMjustslowsthe
- screen-outputdown.CoveryourTOS-screenwithwindowsonlyifyoureally
- needthem.
-
- GFA-Basichasfour"easy"windowsfornottoocomplicatedjobs.Drawan
- imaginarycrossonthescreen.Theintersectionofthetwolinesis
- determinedbythecoordinatesin'OPENWn,x,y'.Ifyoushowmorethanone
- windowonthescreen,youshouldrealizethatresizingonewindowauto-
- maticallychangesthesizeoftheotherthreewindowsaswell(remember
- thecross?).UsetheAESwindow-commandsifyouneedindependentwindows.
-
- ThefourGFA-windowsreservethetoplineforapulldownmenu.Ifyouuse
- yourownAES-windows,youshouldprotectthetoplineyourself,e.g.with
- 'OPENW0'.
-
- Astandard-methodfortheuseofGFA-windowslookslikethis:
- TITLEW#1,"title" !automaticallycentered
- INFOW#1,"information" !leftjustified
- OPENW1 !oruseFULLW#1
- CLEARW1
- (...)
- CLOSEW1
- CLOSEW0
- Idon'tknowhowtouse'#'properly.Theeditordoesnotaccept'#'in
- 'OPEN#1',youhavetouse'OPENW1'.IfyouuseFULLWinsteadofOPENW,
- youhavetouse'FULLW#1'.Inthiscasethe'#'hastobeused,orthe
- commanddoesn'tworkatall!TheGFA-editoralwaysinsertsa'#'after
- TITLEWandINFOW,evenifyoudidn'ttypeone.Whatthe#isgoingon?
-
- ü
- CLOSEWÇ
-
- Ifyouhaveopenedawindowinyourprogram,alwaysuse'CLOSEW0'before
- returningtotheeditor.Ifyoudon't,youcan'tworknormallyinDirect
- Mode.Ifyoudidforget,youcantype'CLOSEW0'inDirectModeand
- everythingworksfineagain.
-
- IfyouusetheAESwindow-commands,alwayscallWIND_CLOSE(handle)before
- WIND_DELETE(handle).
-
-
- üTITLEWÇ
- ü
- ÇYoucanclearatitlewith:
- TITLEW#n,""
- Don'tuse""insteadof"",oryouwon'tbeabletomovethewindow
- afterwards!
-
-
- üCLEARWÇ
-
- After'CLEARW#n'allvisibleareasofthewindowarecleared,êwithoutÇ
- activatingthewindow.GFAusesWIND_UPDATEandWIND_GETforthiscommand.
- 'CLEARWn'bothclearsêandÇactivatesthewindow.
-
-
- üë24.AES-LIBRARY
- Ç
-
- üALERTÇ
-
- IfyouneedanemptylineinanAlert-box,use:
- ALERT,3,"...||...",1,"...",k
- Notethespacebetweenthetwoverticalrules.
-
- GFA-Basicallowsê4Çlinesof30characters(High/Mediumrez)ifyouuse
- ALERT,butwithFORM_ALERTyoucanuseê5Çlines.Inbothcasesyoucanuse
- notmorethan3buttons,eachatmost8characters(High/Mediumrez)wide:
- m$="line1|line2|line3|line4"
- ALERT3,m$,1,"OK",k
- '
- m$="[3][line1|line2|line3|line4|line5][OK]"
- k=FORM_ALERT(1,m$)
-
- InLowresolutionyoucanuseonlyhalfthenumberofcharactersyouuse
- inHigh/Mediumresolution.
-
- Ifsomecharactersarenotvisibleinabutton,trybroadeningtheAlert-
- boxbyaddingspacestothewidesttext-line.
-
- Ifyouhavepressedtheleftmouse-buttonontheveryspotwhereanAlert-
- buttonisabouttoappear,somethinggoeswrong.GEMappearstoremember
- yourlastmouse-click,anderroneouslyassumesyoupressedthebutton
- êafterÇtheAlert-boxappeared.GEMonlyselectsthebuttonifthemouse-
- clickoccurredintheexactareaoftheAlert-button.Toavoidthis
- problemyoushouldmakesuretheuserhasreleasedthemouse-buttonbefore
- youcalltheAlert-box:
- REPEAT
- UNTILMOUSEK=0 !waituntilmousereleased
-
- Bytheway,theAESusesan8Kbuffertosavethepartofthescreenwhere
- theAlert-boxappears.Dittoforamenu.
-
-
- üSHEL_GETandSHEL_PUTÇ
-
- GFA-Basicisrunfroma'Shell-Program',usuallytheDesktop.Inthatcase
- thefileDESKTOP.INFcanbefoundintheEnvironment-Buffer.Youcan
- examinethisfilebytransferringittoastring:
- d$=STRING$(1024,0)
- r%=SHEL_GET(1024,d$)
- PRINTingthisstringismucheasierthanusingadisk-editortoexamine
- DESKTOP.INF.
-
- ÇAfterchangingthestring,youcouldputitbackinthebufferwith:
- r%=SHEL_PUT(1024,d$)
- Thiswayyoucouldchangethelay-outofthedesktop.Ifyouchangethe
- string,youshouldknowthattheDesktoprecognizestheendofDESKTOP.INF
- bythebyte&H1A.Sodon'tforgettoputCHR$(26)attheend.Ifyouwant
- tosavethenewbuffer,try:
- OPEN"O",#1,"\DESKTOP.INF"
- PRINT#1,LEFT$(d$,INSTR(d$,CHR$(26)))
- CLOSE#1
-
-
-
-
-
-
- IsthatallthereistotellabouttheAES-library?Certainlynot,soat
- thispointyouwillprobablybebitterlydisappointed.IavoidtheAES-
- LibrarywheneverIcan.Anyway,thisisasubjectthatisthoroughly
- coveredinmostbooksaboutGFA-Basic3.0.Everyoneisentitledtohisown
- opinionabouttheusefulnessofRSC-filesandotherexoticsubjects.
- Betterstill,writethischapteryourself.Andthesametoyoutoo!
-
-
- üë25.GFAXPERT-FILES
- Ç
-
- Takeyourtimetoreadthischaptercarefully,beforeusingtheGFAXPERT-
- Proceduresorprograms.Theparagraph'STANxxxx.LST'isessentialreading.
- Don'tforgettoreadthe'ásmallprintÇ'inthelastparagraph.
-
-
- üGFAXPERT.DOCÇ
-
- You'rereadingit.
-
-
- üGFAXPERT.LIBÇ
-
- Thisfolder(inGFAXPRT2.ARCfordownloaders)containsalargecollection
- ofProceduresinseveralLST-files.EachLST-filecontainsoneormore
- foldedProcedures.MostProceduresarealsolistedinthistext,orareat
- leastmentioned.IsuggestyouLlistalltheLST-fileswithunfolded
- Proceduresforeasyreference.YoucouldalsoLlistallLST-filesagain
- withfoldedProcedures,soyouwillbeabletolocateaProcedurequickly.
-
- Alwaysreadthecomment-lines('***)inaProcedurebeforeusingit.You
- willfindthereifotherProceduresareused,orStandardGlobals(see
- paragraph'STANxxxx.LST').SometimesaProcedurereturnsaglobal
- variable.MostvariablesaredeclaredasLOCAL.Anddoreadtherelevant
- chapterofthistextbeforeusingaProcedure.
-
- GFAhasreleasedalibraryofgraphics-andsound-routines.Iamcurious
- aboutthequalityoftheseroutines,butIcertainlydonotintendtopay
- DM148.-forthelibrary.Myadvicewouldbetousethelibrary
- GFAXPERT.LIBandpayDM148.-tome.
-
-
- üINLINEÇ
-
- TheINLINE-folder(inGFAXPRT2.ARCfordownloaders)containsINLINE-files
- thatyouwillhavetoloadafterMergingcertainProcedures.Thisis
- clearlyindicatedinsuchProcedures.
-
-
- üSTANxxxx.LSTÇ
-
- Beforewritingaprogram,Idecideinwhichresolutiontheprogramwill
- run.ThenIMergethecorrespondingSTANxxx.LST-file(inthefolder
- GFAXPERT.LIB)andusethatasthestandardframeworkformyprogram:
- STANHIGH.LST -Highresolution
- STANMED.LST -Mediumresolution
- STANLOW.LST -Lowresolution
- STANHIME.LST -HighorMediumresolution
- STANALL.LST -allresolutions
- Afterdeletingthefirsttwolinesandenteringthenameoftheprogram
- (e.g.TEST.GFA),ISavetheprogramasAAPROG.GFAintheProcedure-
- library.InthisfolderIhaveafewLST-filesreadyforeasyMergingof
- ÇProceduresintotheprogram(AABLOCK1.LST,AABLOCK2.LST,etc.).
-
- Beforeyoucontinue,youshouldLlistthefiveSTANxxxx.LST-files.Merge
- STANHIGH.LST,unfoldallProcedures,thenLlist.Intheotherfilesyou
- couldrestrictunfoldingtotheProcedureInitio(andperhapsthe
- Proceduresxxx.modeandStandard.xxx.colors).I'llwaituntilyouhavethe
- listingsoftheSTAN-filesinfrontofyou...
-
- Right,firstI'lldiscussSTANHIGH.LSTthoroughly.LaterI'llpointout
- someimportantfeaturesintheotherSTAN-files.Youwillnotbecomean
- expertinstructuredprogrammingimmediately,butusingtheSTAN-files
- shouldhelp.
-
- (1)Thefirstline('STANHIGH.LST')istheretoremindyouhowto'Save,A'
- thisfileafteryouhavechangedit.Deleteitifyouaregoingtodevelop
- anewprogram.
-
- (2)Enterthenameofyournewprogram(e.g.TEST.GFA)andimmediately
- savetheprogramasAAPROG.GFAintheProcedure-library.
-
- (3)Word-variablesaredefinedasthedefault.
-
- (4)TheProcedureInitioiscalled.InthisProcedurethecurrent
- resolutionischecked,andafterthat,afewimportantglobalvariables
- aredefined(StandardGlobals).ThefollowingStandardGlobalsaredefined
- (readthecommentsinthelistingformoreinformation):
- high.res! scrn.col.max return$
- scrn.lin.max esc$
- default.path$ help$
- white undo$
- physbase% black
- logbase% interpreter$
- on! run.only$
- scrn.x.max off! start.gfa$
- scrn.y.max start.prg$
- bel$
- char.width
- char.height
- Also,theStandardArraycolor.index()iscreated,althoughyou'llonly
- needitforafewProcedures(e.g.Initio.sprite1).
-
- (5)TheProcedureTitle.screenisnotactivatedyet.You'llprobablywant
- tochangethatProcedure.
-
- (6)Anormal<Break>shouldbepossiblewhiledevelopingaprogram.Inthe
- finishedprogramyoucouldactivatetheProcedureBreak,ordeleteit.Be
- verycarefulwith<Break>iftheprogramusesRESERVEorhaschangedthe
- addressofthephysical/logicalscreen.
-
- (7)ThemainprogramusuallyisnotmuchmorethanalistofProcedure-
- calls,e.g.:
- @start.game
- @play.game
- @score
- Ç(8)TrytoleavetheprogrambycallingtheProcedureExit.During
- developmentit'smoreconvenienttoleavewith'EDIT'.
-
- (9)TwoStandardFunctionsaredefined:Center$forcenteringtextand
- Rev$forPRINTingreverse.ThelastfunctionusesVT52-codes,souseiton
- theTOS-screenonly.
-
- (10)TheStandardProcedureHigh.mode(calledfromInitio)checksthe
- currentresolutionandabortswithanappropriatemessageiftheprogram
- isruninthewrongresolution.
-
- (11)TheStandardProcedureGet.path(calledfromInitio)returnsthe
- currentpath.Usingtheinterpreter,GEMDOSreturnsthepathofthe
- interpreter(e.g.'A:\'),ênotÇoftherunningprogram!That'swhyIuse
- CHDRIVE+CHDIRintheshell-programs.InthatcasetheStandardGlobal
- default.path$doescontainthepathoftherunningGFA-program.Ifyou
- developtheprogram,youshoulduseCHDRIVE/CHDIRinDirectModeif
- necessary.Iamnothappywiththismethod,butIknownoothersolution
- forGFA-programs.IfIdon'tusethismethod,Ialwaysdefinethepathin
- theInitiation-part,e.g.:
- path$="A:\GAMES\" !wherearethedata-files?
- NowanotherGFA-useronlyhastochangethepathandtheprogramcanfind
- thenecessaryfiles.ForownersoftheRun-Onlyinterpreteryoushould
- describetheproperconfigurationinaREAD.ME-file.WithcompiledGFA-
- programsthereisnoproblem,becauseGEMDOSwillreturnthepathofthe
- runningprogram.
-
- (12)Iliketobegineveryprogramwithatitle-screen.Changethe
- StandardProcedureTitle.screen,ordeleteitifyoudon'tliketitle-
- screensinyourprograms.
-
- (13)TheStandardProcedureReturnisusedbyTitle.screen.
-
- (14)TheStandardProcedureBreakcanbedeletedifyoudon'tneedit.
- Don'tuse'ONBREAKCONT'inyourprogram,unlessyouhaveaverygood
- reasontodoso.NotethatIhavemadeitpossibletouse<Break>the
- normalwayiftheuserchooses<CONT>whilepressingthe<Break>-
- combination.
-
- (15)TheStandardProcedureExitshouldalwaysbeused.ThisProcedure
- triestogobacktooneoftheshell-programs.Ifthat'simpossible,the
- Proceduredecidestoendwith'EDIT'or'SYSTEM'.Isitpossibletotest
- inaprogramifitisrunbytheinterpreterorifitisacompiled
- program?Iftheanswerisyes,thisProcedurecouldbeimproved.
-
- (16)OtherProcedurescanbeinsertedafter'***Procedures***'.Merge
- ProceduresfromthelibraryGFAXPERT.LIB(oryourownlibrary)here.Iuse
- thefollowingmethod:
- -New,somemoryisclear
- -MergerelevantLST-filefromlibrary
- -choose(folded)ProcedureandWriteasblocktoAABLOCKx.LST
- -repeatpreviousstepsforotherProcedure(s)
- -LoadAAPROG.GFA
- -MergeAABLOCKx.LSTatappropriateposition(s)
- Ç -Saveprogram(press<Return>inFileselector)
- Ofcourse,you'llhavetowriteafewProceduresfromscratch.Beforeyou
- knowit,you'llhavereachedTheEnd.It'ssoeasytowriteaprogramin
- GFA-Basic3.0,thatIactuallyenjoyprogramming.
-
- (17)Debuggingisperhapslessfunthanprogramming.MergetheProcedure
- Debugtemporarilyinyourprogramifyouneedsomehelp.Anddosaveyour
- programregularly!FallbacktotheprogramAAPROG.BAKifyourlatest
- improvementswerefatal.Ifyouarecompletelysatisfied,savetheprogram
- underitspropername(TEST.GFA).Alsosaveaback-uponanotherdisk,
- justincasesomethingterribleshouldhappentoyouroriginalprogram.
-
- (18)InSTANALL.LSTyou'llnoticeintheProcedureInitiothatIalways
- startwiththedefaultpalette(ProceduresStandard.med.colorsand
- Standard.low.colors).NewStandardGlobalsinSTANALL.LSTare:
- red med.res!
- green low.res!
- TheStandardArraycolor.index()isveryimportantinMediumorLow
- resolution.
-
- (19)InSTANHIME.LST(myfavourite)theonlyimportantdifferenceisthe
- ProcedureHigh.med.mode,wherethecurrentresolutionischecked.
-
- (20)InSTANLOW.LSTall16default-coloursarenowdefinedasStandard
- Globals :
- white blue grey l.purple
- black d.blue l.black d.purple
- red brown l.blue d.yellow
- green d.green bluegreen l.yellow
- WithtwonewStandardFunctionsyoucanchangethecolourofPRINTedtext
- (Ink$)orthecolourofthebackground(Paper$).Bothfunctionsworkon
- theTOS-screenonly.ThecurrentresolutionischeckedintheProcedure
- Low.mode.
-
- (21)NothingnewinSTANMED.LST,excepttheProcedureMed.modetocheck
- theresolution.
-
- Perhapsyoufindallthistalkabouta"standard"program-structurevery
- boring.Ifyouwriteaprogram,whycareaboutstructure?Becauseit's
- mucheasiertochangeastructuredprogram,especiallyifyoudidn'twrite
- theprogramyourself.Changeanunstructuredprogram,andyou'regoingto
- besurprisedbysome(hidden)unwantedside-effects.Makeotherusers
- happy,spreadyourbeautifulprogramsonlyiftheyarestructuredandwell
- commented.Dospreadthe(listable)êsourceÇofyourprogram,sootherusers
- canlearnfromyou.Anddon'tbeinsultedifothersimproveyourprogram.
- Icertainlywillnotbeinsultedifyousendmeyourownthoughtsabout
- structuredprogramminginGFA-Basic3.0.
-
-
-
- üSTART
- Ç
- IntheSTART-folder(inGFAXPRT2.ARCfordownloaders)youwillfindthe
- followingprograms:
- START.GFA -HighorMediumresolution
- STARTLOW.GFA -Lowresolution
- GFASTART.GFA -allresolutions
-
- IusetwodifferentdisksformyGFA-programs.Oneforprogramsthatrun
- inHighand/orMediumresolution(savethedesktopinMediumresolution!).
- AndoneforprogramsthatruninLowresolution.
-
- START.GFAandSTARTLOW.GFAareusedasakindofshelltoruntheGFA-
- programsonthesedisks.Notatrueshell,butit"feels"likeallGFA-
- programsarerunfromSTART.GFAandSTARTLOW.GFA.IstartaGFA-session
- bydouble-clickingtheshell-programonthedesktop('GFA'hasbeen
- installedasapplicationforGFABASIC.PRG).
-
- AllmyprogramstrytoCHAINoneoftheshell-programswhentheuserexits
- theprogram.Twoimportantremarksifyoudecidetousetheseshell-
- programs:
- -verticalfrequencyisswitchedto60HzinMediumorLowresolu⑨
- tion;notagoodideaifyouuseaTVthroughamodulator!
- -WriteVerifyTestisswitchedoff
- Ifyoulike,youcanactivatethecheckforaboot-virusintheshell-
- programs.Theshell-programandGFABASIC.PRG(orGFABASRO.PRG)shouldbe
- inthemaindirectory!
-
- GFASTART.PRGisusedinthesamewaywithcompiledGFA-programs.Allmy
- compiledGFA-programstrytoCHAINthisshell-programwhenexiting.The
- sourceforthisprogramisGFASTART.GFA.CompilethisasGFASTART.PRGand
- putitinthemaindirectory.
-
- AllthreeSTART-programscontainplentycomments,soyoushouldbeableto
- understandhowtheprogramsworkbystudyingthelistings.Theshell-
- programscertainlycanbeimproved,I'mnotyetsatisfiedwiththecurrent
- programs.
-
-
- ísmallprintÇ
-
- Readthisparagraphcarefully,beforeusingtheGFAXPERT-files.Thefiles
- areênotÇPublicDomain!
-
- YouarefreetouseandchangeallGFAXPERT-files,butonlyforpersonal
- use.Certainlynotforcommercialuse.
-
- YouareinvitedtocopytheoriginalGFAXPERT-diskortheGFAXPRTx.ARC-
- filesandgivethesetoyourfriends.Butyouarenotallowedtochange
- anythingonthediskorinthefiles.Ifyoufeeltheurgetochange
- something,don'tdoit,butwritetome(readthechapter'EPILOGUE').
-
- Youarenotallowedtosell(filesfrom)theGFAXPERT-diskoroneofthe
- GFAXPRTx.ARC-files.ThediskGFAXPERTmayonlybesoldbyso-calledPublic
- DomainClubsiftheyhavemywrittenpermissiontodoso.BBS'sarefree
- tomaketheoriginalGFAXPRTx.ARC-filesavailablefordownloading.
-
- AnypartfromthetextGFAXPERT.DOCortheProcedure-libraryGFAXPERT.LIB
- maybequotedinnewslettersormagazines,ifaccompaniedbyareference
- like:
- fromGFAXPERT(2nded.)byHanKempen
-
- Icannotbeheldresponsibleforanydamagethatmayresultfromrunninga
- GFAXPERT-program,usingaProcedurefromthelibraryGFAXPERT.LIB,or
- usinginformationfromthistext.
-
-
- (c)HanKempen,3July1990
-
-
- üëEPILOGUE
- Ç
-
- Well,that'sallfolks.I'mquitecertaintherearestillafewbugstobe
- foundinthistextandintheProcedure-LibraryGFAXPERT.LIB.Bynowyou
- shouldhavebecomeanexpertinGFA-Basic3.0,soyouwillbeabletospot
- thembugsimmediately.Pleaseletmeknowifyoufindone.
-
- PerhapsyoustillhavesomeunansweredquestionsaboutGFA-Basic.Oran
- answertooneofmyownquestionsinthistext.OrsomeneatProcedures.
- Orabrilliantprogram.Iwouldappreciateitverymuchifyouwouldsend
- yourletterand/ordiskto:
-
- HanKempen
- Rubensstraat12
- 7741ARCoevorden
- theNetherlands
-
- Doshareyourideas,Proceduresandprogramswithothers,startingwith
- me.ConsideritasmallpaymentfortheGFAXPERT-files.Thanks.
-
-
-
-
-
-
- WishingyoumanyhappyhourswithGFA-Basic3.0,
-
-
- HanKempen
-
-
- üëINDEX
- Ç
-
-
- (#) = Procedure or Function
-
-
- \ ..................................... 29
- " ..................................... 41
- 1st Word Plus ......................... 62
- 40-folder limit ....................... 66
-
- abbreviated commands .................. 12
- accessory ............................. 25,101
- ACHAR ................................. 96
- ACLIP ................................. 99
- After$ (#) ............................ 32
- AFTER ................................. 82
- ALERT ................................. 106
- application ........................... 9
- ARECT ................................. 88
- ASCII-code ............................ 33,34,36,37
- Ascii.qsort (#) ....................... 27
- ATEXT ................................. 96
- attribute ............................. 53
- AUTO .................................. 9
-
- BCHG .................................. 30
- BCLR .................................. 29
- Before$ (#) ........................... 32
- Bezier-curve .......................... 92
- BGET .................................. 62
- BIOS 4 (Rwabs) ....................... 59
- BIOS 7 (Getbpb) ...................... 56,60
- BIOS 9 (Mediach) ..................... 60
- BIOS 10 (Drvmap) ...................... 51
- BIOS 11 (Kbshift) ..................... 36
- bit-mask .............................. 29
- Blitter (#) ........................... 99
- BLOAD ................................. 61
- Block.dimmer (#) ...................... 91
- Boolean ............................... 17
- boot .................................. 9,61
- BPB ................................... 56
- BPUT .................................. 62
- break ................................. 10
- Break (#) ............................. 110
- BSAVE ................................. 61
- BSET .................................. 30,79
- bug (GFA) ............................. 12,20,24,25,31,32,36,42,80,83,
- 84,92,96,97,101
- bug (TOS) ............................. 25,35,55,56,63,64,66,70,95,102
-
- Çcalculations .......................... 79
- Caps (#) .............................. 39
- CapsLock .............................. 38
- CARD .................................. 31
- CHAIN ................................. 83
- Change.font (#) ....................... 44
- Change.midi.buffer (#) ................ 67
- Change.palette (#) .................... 85
- characters ............................ 16,34
- CHDIR ................................. 51,110
- CLEAR ................................. 19
- CLEARW ................................ 105
- CLIP .................................. 92
- CLOSEW ................................ 104
- cluster ............................... 58
- Coldstart (#) ......................... 9
- color ................................. 40
- Color.cycle (#) ....................... 86
- correlation ........................... 31
- COSQ .................................. 30
- CURVE ................................. 92
- Cut and Paste ......................... 13
- Cycle.once (#) ........................ 87
-
- DATE$ ................................. 22
- Day.of.week (#) ....................... 22
- Debug (#) ............................. 19,111
- DEFFILL ............................... 87
- DEFLINE ............................... 89
- DEFLIST ............................... 15
- DEFMARK ............................... 87
- DEFMOUSE .............................. 72
- DEFTEXT ............................... 89
- DEFWRD ................................ 17
- Degas-Pictures ........................ 97
- Degas.screendump (#) .................. 46
- DELAY ................................. 83
- Desk-submenu .......................... 103
- DESKTOP.INF ........................... 106
- DFREE ................................. 56,58
- Digital$ (#) .......................... 93
- DIM ................................... 19
- Dim.colors (#) ........................ 86
- DIR$() ................................ 50
- DIR ................................... 51
- Direct mode ........................... 15
- disk format ........................... 55
- disk-swap ............................. 60
- Do.sound (#) .......................... 76
- DRAW .................................. 91
- DTA-buffer ............................ 52
- DUMP .................................. 19
-
- ÇEditor ................................ 71
- EQV ................................... 31
- ERASE ................................. 19,24
- ERROR ................................. 82
- EVERY ................................. 82
- EXEC .................................. 24,83
- EXIST ................................. 54
- Exit (#) .............................. 110
-
- fade-over ............................. 99
- Fastprint (#) ......................... 41
- FAT ................................... 58
- FDC ................................... 55
- FGETDTA ............................... 52
- File Allocation Table ................. 58
- File.copy (#) ......................... 55
- File-submenu .......................... 103
- FILES ................................. 51
- FILESELECT ............................ 63
- Fileselect (#) ........................ 64
- Fileselector .......................... 63,71
- floating point ........................ 18
- Floppy Write Test ..................... 50
- Folded Procedures ..................... 13
- font .................................. 43,89
- Font.8x16 (#) ......................... 43
- Font.8x8 (#) .......................... 43
- FONTKIT ............................... 44
- FOR ... NEXT .......................... 79
- Force.mediach (#) ..................... 60
- FORM_ALERT ............................ 106
- FSETDTA ............................... 52
- FSFIRST ............................... 52
- FSNEXT ................................ 52
- Full.fill (#) ......................... 88
- FULLW ................................. 104
- FUNCTION .............................. 19
-
- GEMDOS 17 (Cprnos) .................... 45
- GEMDOS 25 (Dgetdrv) ................... 50
- GEMDOS 48 (Sversion) .................. 10
- GEMDOS 54 (Dfree) ..................... 56
- GEMDOS 67 (Fattrb) .................... 53
- GET ................................... 96
- Get.path (#) .......................... 110
- GFA-windows ........................... 104
- GFAXPERT.DOC .......................... 7,108
- GFAXPERT.LIB .......................... 7,108
- GOSUB ................................. 82
- GOTO .................................. 82
- GRAPHMODE ............................. 90
-
- ÇHARDCOPY .............................. 45
- harddisk .............................. 51,55,58,59
- High.screendump.epson (#) ............. 45
- High.screendump.star24 (#) ............ 45
- HLINE ................................. 96
-
- IBOX .................................. 102
- IF ... ENDIF .......................... 78
- INFOW ................................. 194
- Initio (#) ............................ 109
- Initio.fill1 (#) ...................... 88
- Initio.high.fill1 (#) ................. 87
- Initio.keyget (#) ..................... 36
- Initio.logical.screen (#) ............. 42
- Initio.mouse1 (#) ..................... 72
- Initio.printer (#) .................... 47
- Initio.sound (#) ...................... 75
- Initio.sprite1 (#) .................... 93
- Initio.text.array (#) ................. 62
- Ink$ (#) .............................. 40
- INKEY$ ................................ 33
- INLINE ................................ 24,108
- INP ................................... 62,67,70
- INPAUX$ ............................... 70
- INPMID$ ............................... 67
- INPUT ................................. 34,62
- INPUT$ ................................ 35
- Insert-mode ........................... 15
- INSTR ................................. 32
- INT{} ................................. 23
- integer ............................... 18
- Intel.word (#) ........................ 31
- interleave ............................ 57
- Invert.block (#) ...................... 91
-
- joystick .............................. 74
-
- Key.click (#) ......................... 38
- Key.repeat (#) ........................ 39
- keyboard .............................. 37
- keyboard-buffer ....................... 33
- Keyboard.version (#) .................. 37
- KEYDEF ................................ 37
- KEYGET ................................ 35
- KEYLOOK ............................... 36
- KEYPAD ................................ 37
- KEYPRESS .............................. 37
- KEYTEST ............................... 35
- KILL .................................. 54
-
- ÇLine-A ................................ 95
- LINE INPUT ............................ 35,62
- Llist ................................. 14
- Load .................................. 13
- LOCATE ................................ 41
- LOF ................................... 54
- LOG ................................... 30
- logical screen ........................ 42
- loops ................................. 80,119
- LSET .................................. 32
-
- Make.high.fill (#) .................... 88
- Make.mouse (#) ........................ 73
- Make.palette.string (#) ............... 85
- Make.sprite (#) ....................... 94
- MALLOC ................................ 25
- MAX ................................... 31,78
- Max.array (#) ......................... 31
- memory ................................ 23,24,25
- MENU() ................................ 101
- Midi-buffer ........................... 67
- Midi-commands ......................... 67
- Midi.monitor (#) ...................... 68
- MIN ................................... 78
- MOD ................................... 29
- monitor ............................... 10
- MOUSE ................................. 71
- MS-DOS disk ........................... 58
-
- NAME .................................. 54
- Neochrome-Pictures .................... 98
- New.med.colors (#) .................... 85
- Normal.font (#) ....................... 44
- NOT ................................... 81
-
- OBOX .................................. 102
- ON BREAK GOSUB ........................ 82
- ON MENU BUTTON ........................ 101
- ON MENU IBOX .......................... 102
- OPENW ................................. 104
- OPENW 0 ............................... 103
- Operating System ...................... 10
- OUT ................................... 40,62
- Overwrite-mode ........................ 15
-
- palette ............................... 84,111
- Palette.box (#) ....................... 86
- Paper$ (#) ............................ 40
- Parse.filename (#) .................... 65
- parser ................................ 32
- PCIRCLE ............................... 92
- physical screen ....................... 42
- ÇPlay.midi (#) ......................... 68
- PLOT .................................. 91
- point-commands ........................ 14
- PRED .................................. 29
- PRINT ................................. 40
- Print.stopwatch (#) ................... 21
- PRINT TAB ............................. 42
- printer-commands ...................... 47
- printer-driver ........................ 14
- printer-parameters .................... 45
- Printer.ready (#) ..................... 45
- PUT ................................... 96
-
- QSORT ................................. 26
-
- RAM ................................... 23
- RAM-disk .............................. 50
- READ .................................. 20
- RECALL ................................ 62
- Record.midi (#) ....................... 67
- RESERVE ............................... 23
- reset ................................. 9,50
- RESTORE ............................... 20
- Restore.palette (#) ................... 85
- Restore.physical.screen (#) ........... 43
- Return (#) ............................ 110
- reverse ............................... 41,84
- Rgb.value (#) ......................... 85
- right justification ................... 32
- RS232-buffer .......................... 70
- RSET .................................. 32
- Rubber.line (#) ....................... 90
-
- samples ............................... 76
- Save .................................. 14
- Save,A ................................ 14
- Save.palette (#) ...................... 85
- scan-code ............................. 33,36,37,38
- scrap-library ......................... 83
- Screen.dimmer (#) ..................... 91
- Screendump (#) ........................ 45
- Scroll.text.up (#) .................... 99
- Scroll.up (#) ......................... 98
- sectors ............................... 59
- SELECT ................................ 78
- serial number ......................... 57
- SETCOLOR .............................. 84
- SETMOUSE .............................. 71
- SHEL_GET .............................. 106
- SHEL_PUT .............................. 106
- shell-program ......................... 112
- SHL ................................... 79
- Show.degas (#) ........................ 97
- Show.text.page (#) .................... 63
- ÇShuffle (#) ........................... 20
- SINQ .................................. 30
- SOUND ................................. 75
- Soundmachine .......................... 77
- special characters .................... 16
- speech ................................ 77
- SPRITE ................................ 93
- SSORT ................................. 26
- Standard .............................. 7
- Standard Array ........................ 109,111
- Standard Functions .................... 110,111
- Standard Globals ...................... 109,111
- STANxxxx.LST .......................... 108
- START ................................. 112
- start-up .............................. 9
- Step Rate ............................. 50
- STICK ................................. 74
- Stopwatch (#) ......................... 21
- STORE ................................. 62
- STRIG ................................. 74
- String.index.qsort (#) ................ 28
- SUCC .................................. 29
- supervisor mode ....................... 23
- SWAP .................................. 20,31
- Swap.screen (#) ....................... 43
- syntax ................................ 12
- system-font ........................... 43,89
-
- Tab ................................... 13,41
- TAB ................................... 42
- TEXT .................................. 92
- text-array ............................ 62
- Text.at (#) ........................... 92
- TIME$ ................................. 21
- Time (#) .............................. 21
- TIMER ................................. 21
- Title.screen (#) ...................... 110
- TITLEW ................................ 104,105
- TOS ................................... 10
- TOS-screen ............................ 40
- TOUCH ................................. 54
- twisted format ........................ 57
- TYPE .................................. 20
-
- VAR ................................... 18
- variable type ......................... 17
- VDISYS 38 (vqt_attributes) ............ 89
- VQT_EXTENT ............................ 95
- VSETCOLOR ............................. 84
- VSYNC ................................. 98
- VT52 .................................. 40
-
- ÇWarmstart (#) ......................... 9
- WAVE .................................. 75
- WIND_CLOSE ............................ 104
- word .................................. 17,31
- WORD .................................. 23,59
- write-protect ......................... 60
-
- XBIOS 0 (Initmous) ................... 71
- XBIOS 5 (Setscreen) .................. 42
- XBIOS 6 (Setpalette) ................. 85,97
- XBIOS 7 (Setcolor) ................... 84
- XBIOS 8 (Floprd) ..................... 60
- XBIOS 10 (Flopfmt) .................... 56
- XBIOS 15 (Rsconf) ..................... 70
- XBIOS 16 (Keytbl) ..................... 37,38
- XBIOS 18 (Protobt) .................... 57
- XBIOS 19 (Flopver) .................... 56
- XBIOS 32 (Dosound) .................... 75
- XBIOS 33 (Setprt) ..................... 45
- XBIOS 36 (Prtblk) ..................... 47
- XBIOS 64 (Blitmode) ................... 99
-
-